This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Celeste DeMartis
Posted Aug 11 - Read on Facebook

I'm looking to have a continuous spinning animation with a variable speed. My attempt was to update animationTime based on either an external event... this seems to work at first but then there are unexpected behaviors. What would be the best way to handle this?

4 Comments

Andrew Nalband

A few small modifications and we're there. You can actually pass "animationTime" as an argument to your "spin" function so you don't have to manage it as a global variable (take a look at the example and ask me questions if I'm not explaining that clearly enough). The reason you're getting an unexpected result is that the speed of rotation is being set based on a start and end point. In your example, the end point is 360. Each time you click the buttons, the start point is the current rotation of the "spinning_thing" mid-spin. If we just add the current rotation (spinning_thing.rotation) to 360 in your "spin" function, we're there!

https://framer.cloud/krpyU

Andrew Nalband

Here's a screenshot of the code in the example above for quick reference

Celeste DeMartis

Perfect, makes sense and works, thanks so much!!

Andrew Nalband

You're wecome!

Read the entire post on Facebook