-
Random rotation of multiples of 90°, every second
Hi all,
I’m learning expression slowly and recently learned using basically seedRandom and ease expression, which I though of applying here, but for some reason, I’m not getting to what I’m aiming.So, my set up is as follows:
I have 4 items that I want to rotate every second of a -360°, -270°, -180°- -90°, 0, 90°, 180°, 270° or 360° spin.The script I originally used was to make the 4 last spins, but even there, I’m not getting something proper. Every second it should spin of a multiple of 90°, and take half of a second to get there. Here is my script:
segDur = 1;
seed = Math.floor(time/segDur);
segStart = seed*segDur;
seedRandom(seed,true);
startVal = random(0-4)*90;
seedRandom(seed+1,true);
endVal = random(0-4)*90;
ease(time,segStart,segStart + (segDur/2), startVal, endVal);It does spin but of various amount of degrees between 0 and 360° whereas I would like to restrict it to only multiples of 90°.
Can anyone tell me where I have wrong?
Thanks a lot in advance