Page 1 of 1

Rotating every frame a certain degree (Expression)

PostPosted: Tue Jun 08, 2021 10:14 am
by Sanse.
Hi it's me again,

Was wondering if I could rotate something via expression for example with a degree of 22,5 every frame so that it has the degree of 45 at the second frame.

I looked at the expression cheat sheet but couldn't figure something out

I guess you could somehow use "Keyframe stretcher" for that too in some way.

Can someone help?

Re: Rotating every frame a certain degree (Expression)

PostPosted: Tue Jun 08, 2021 12:05 pm
by Sander de Regt
Yes. Just create a simple expression on an angle control and enter

Code: Select all
time*22.5


And that's it.

Re: Rotating every frame a certain degree (Expression)

PostPosted: Wed Jun 09, 2021 10:01 pm
by Sanse.
Mh I tried that but it just speed up the whole thing instead of looking choppy/stop motion like.

Re: Rotating every frame a certain degree (Expression)

PostPosted: Wed Jun 09, 2021 10:18 pm
by David Ward
Bit unclear as to what you are trying to achieve. If you want a picture to rotate 22.5 degrees every frame it is going to perform a complete revolution in 16 frames and will look quite fast. What effect are you trying to achieve? Do you want it to snap to a degree of rotation and stop for a stop motion effect?

Re: Rotating every frame a certain degree (Expression)

PostPosted: Mon Jun 14, 2021 1:10 am
by Sanse.
Oh I see now, it has of course to stay on that degree for a while so it wouldn't be on every frame.
What I try to achieve is a choppy stop motion look instead of a smooth/fast rotation.
I'll try to figure something out next time I work on it, thanks for the help. :D

Re: Rotating every frame a certain degree (Expression)

PostPosted: Mon Jun 14, 2021 4:35 am
by Bryan Ray
Try this:

math.floor(time/[interval])*22.5

where [interval] is the number of frames you want to wait between rotations.

math.floor() is a function that rounds down to the nearest integer, so math.floor(2.6) = 2. By dividing time by your interval, it will only tick upward when the numerator is a multiple of the interval.