How to make user-created drawings "vibrate?"
in
Programming Questions
•
1 year ago
Hi there! My name is Arielle, and I'm a game design student. I'm currently taking a class called "Frontiers of Game Design," where we use Processing to make interactive art. I have a project due next week, and I decided to make a program called "Rainbow Squigglevision Maker." Basically, the user can draw within the canvas, akin to making a drawing in Microsoft Paint. The ellipses that make up the drawing have a random stroke and fill, and they will "vibrate" when drawn, which will give it a similar appearance to the "squigglevision" animation technique. The problem is, I don't know how to make the shapes continuously "vibrate" once they're drawn.
Here's what I have done so far:
Here's what I have done so far:
- Let the user draw small ellipses on the canvas when the mouse is pressed
- Randomize the fill and stroke of each ellipse
- Let the user "erase" their canvas (technically, turn it white) when the spacebar is pressed
I just need help with getting the ellipses to vibrate in place once they're drawn. Here's what I've written so far:
// Sets up the canvas.
void setup() {
// Size of canvas is 500 x 500
size(500,500);
// Background color is 255 (white)
background(255);
}
void draw() {
// Nothing happens in draw() in this example!
}
// When the mouse button is clicked and dragged, the code executes.
// When the mouse is dragged, create the ellipses.
void mouseDragged() {
// Randomizes color for ellipse stroke from CMYK
stroke(random(255), random(255), random(255), random(255));
// Randomizes color for ellipse fill from CMYK
fill(random(255), random(255), random(255), random(255));
// Draws ellipse from center.
ellipseMode(CENTER);
// Size of ellipse.
ellipse(mouseX,mouseY,10,10);
}
// When a key on the keyboard is pressed, the code executes.
// Pressing the key "erases" all the user's drawings, because it makes everything 255 (white - the same color as the background/canvas).
void keyPressed() {
// Background comes 255 (white) when key is pressed.
background(255);
}
Thanks in advance,
Arielle
punchkickgame.wordpress.com
Thanks in advance,
Arielle
punchkickgame.wordpress.com
1