# Animation Play, Pause, and Reset

Play and pause an animation in a graph with a single button click. Reset the animation at the end of the loop.

I donâ€™t understand what the P=mod(p,2) is there for - but when I delete it, nothing works so it seems important. Iâ€™m trying to get a rotation to animate but all I can do so far is get the original, have a student enter the degrees, and have the image appear when student hits the submit button. Trying to find an easier way other than defining sub-polygons to appear at some intervals of time.

the mod function is used here to alternate between odd and even button presses. Odd presses = play, even = reset.

If youâ€™re looking to have a polygon rotate, you can make the points in polar form rather than raw cartesian. That way the angle can be manipulated with a single sink.

Hope this helps!

1 Like

mod(p,2) is basically outputting the remainder of p/2, so even numbers it equals 0, and odd 1. Thus, as Jay said, odd number of presses, p, = play, and even = reset.

Okâ€¦ so, would you mind looking at slide 6 in here (please ignore the rest, itâ€™s a work-in-progress and Iâ€™m not sure which slides to delete yet!) and tell my why my play/pause button doesnâ€™t work? 7.2.1 Intro to Special Quads and Proofs â€˘ Activity Builder by Desmos

Hereâ€™s what I came up with. I put all my new work in the New Stuff folder with notes. I put comments for anything I added in the button and graph CL.

1 Like

Thanks, Daniel, youâ€™re awesome! I had been wondering why people always redefine component names at the top of the CL, now that makes sense. I also hadnâ€™t known how to turn lists to be able to use them as variable, so thanks for that tip as well!! Iâ€™ll play around with this some more, I donâ€™t fully understand where the â€śthisâ€ť came from in your graph CL, but now I can get this thing rotating, thanks again!!

you use this to refer to the component youâ€™re in, so instead of â€śgraph4â€ť within graph4, you can use â€śthisâ€ť (i.e. â€śthis componentâ€ť) again so you donâ€™t need to change any component names when copying the slide.

1 Like