Animation

Now you know how to call and create functions, how to use and create variables, and how to use if statements.


This is a companion discussion topic for the original entry at https://happycoding.io/tutorials/p5js/animation

I have created an android sprite in p5.js and I would like to know how to group this 2d shape consisting of circles, rectangles and arcs.

I want to be able to make this grouped object appear each time I click the mouse

You have a few options worth considering.

Option 1: You could use the createGraphics() function to create a buffer that you draw your shapes to. After that, you can treat your buffer as an image, and draw it as a single unit.

Option 2: You could create a function or a class that draws all of the shapes as a unit. Then you’d call your function, or instantiate your class and then call its functions, to draw your shapes.

Some tutorials that might come in handy:

Animation is awesome.
Guys, check out my random walk program. :smile::sunglasses:

1 Like

This looks great!

It almost looks like a map!

1 Like

ya :smile:

how can i make my own animation without toutorials popping up evry minute

Hey Sydnee, where are you seeing tutorial pop up?