Need help with animation play and pause

Slide 7 is the one I am trying to animate with a button. I copied Jay’s code pretty much exactly… and thought I understood what he was doing, but obviously not. Thanks for the help in advance.

I’ve had a look but am really struggling to unpick what is going on. Can you clarify what, exactly, you are expecting to happen when you press the Play button?

For reasons why things might not be as you expect:

You currently have P defined three different ways.
image

Given that you’re defining m in terms of a condition on P, you would need a unique variable.

number("m"):when graph1.number("P")=1 act1.timeSincePress

Further, m is defined as M0+1 in the graph but would be being overwritten by the CL. This means M0 is not ever going to change, but is being captured elsewhere.

Again, it’s difficult to unpick exactly what you’re expecting to happen, so any clarity you can offer will be very helpful.

2 Likes

Given what @pirsquared noted. You should probably remove “P=” from the the two points. They will still graph and work as needed (unless you refer to their coordinates somewhere).

1 Like

Thanks, I thought that in order to name a point, it had to be P. I just changed two of the P’s to different variables. I was trying to get a picture of Sonic to move across the screen with a play button. It works now. Thank you so much!

There aren’t really any restrictions to naming your points. Capital, lowercase, full words as long as everything following the initial letter is part of the subscript. You also are not required to name the points. So you could just have the coordinates defined. It will graph as normal. You’re just unable to reference to point for other calculations.