1

I want to animate a representation digital counter. It is a segmented circle, and each time the counter increments it should move one step forward.

enter image description here

My plan is to start with a graphic with all the segments visible, and then use a mask to block out the "selected" segment - it should look like a digital sweep around the circle.

I can do this with rotation quite easily, but it will be "analogue", in that it will reveal parts of the segment rather than make a discrete change. How can I make an object rotate snappily by x degrees every second, rather than smoothly rotating?

Only way I can think is to use expressions, and set a stepped value, but is there a better (simpler) way?

2

Figured out how to do it with expressions. You need to know the time taken for a full rotation and the number of degrees you want to increment.

degrees = 6; // Number of degrees to rotate by
fullRotationTime = 60000; // Number of milliseconds to complete a full 360 degree rotation

steps = 360/degrees; // Number of steps in one rotation  
divisor = fullRotationTime / steps; 

ms = 1000*time; // Milliseconds since start
degrees*(Math.floor(((ms)/divisor)%steps))

This example will "tick" once a second for 60 seconds.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.