ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Rotation with duration, holds for 1 sec. then repeats

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
John Osteen
Rotation with duration, holds for 1 sec. then repeats
on Nov 2, 2011 at 11:45:44 pm

I'm trying to set up an expression that will rotate a null 36 degrees every second, but I need the rotation to last 5 frames and hold its position until the next second comes around. Does anyone have any ideas on this one? I'm at a complete loss.

John Osteen
DastardlyStudios.com


Return to posts index

Dan Ebberts
Re: Rotation with duration, holds for 1 sec. then repeats
on Nov 3, 2011 at 12:10:26 am

This should be close:

segDur = 1;
rampDur = 5*thisComp.frameDuration;
degrees = 36;
t = (time - inPoint)%segDur;
seg = Math.floor(time/segDur);
degrees*seg + linear(t,0,rampDur,0,degrees)

Dan



Return to posts index

John Osteen
Re: Rotation with duration, holds for 1 sec. then repeats
on Nov 3, 2011 at 12:23:49 am

Dan, you are the man! Would've never figured that out on my own. Thank you.

One last question though, what would I change if I need another one to rotate every 10 seconds?

John Osteen
DastardlyStudios.com


Return to posts index


Dan Ebberts
Re: Rotation with duration, holds for 1 sec. then repeats
on Nov 3, 2011 at 12:46:22 am

segDur = 10;


Dan



Return to posts index

Roland R. Kahlenberg
Re: Rotation with duration, holds for 1 sec. then repeats
on Nov 7, 2011 at 6:29:16 pm

Hi Dan, the Expression script doesn't seem to like layers not starting at time=0. Is there a way to fix this elegantly?

Cheers
RoRK

Intensive AE & Mocha Training in Singapore and Malaysia
Adobe ACE/ACI (version 7) & Imagineer Systems Inc Approved Mocha Trainer


Return to posts index

Dan Ebberts
Re: Rotation with duration, holds for 1 sec. then repeats
on Nov 7, 2011 at 7:52:02 pm

Good catch. This should fix it:

segDur = 1;
rampDur = 5*thisComp.frameDuration;
degrees = 36;
t = (time - inPoint)%segDur;
seg = Math.floor((time-inPoint)/segDur);
degrees*seg + linear(t,0,rampDur,0,degrees)


Dan



Return to posts index


Roland R. Kahlenberg
Re: Rotation with duration, holds for 1 sec. then repeats
on Nov 8, 2011 at 9:42:11 pm

Thanks Dan!

RoRK

Intensive AE & Mocha Training in Singapore and Malaysia
Adobe ACE/ACI (version 7) & Imagineer Systems Inc Approved Mocha Trainer


Return to posts index

John Madison
Re: Rotation with duration, holds for 1 sec. then repeats
on Apr 16, 2012 at 3:56:02 pm

Hi Dan,

I was looking for a similar expression, however my set is slightly different. I was wondering if you can help!

I have the following set up with stroke-only circles and masks:



The black bit is just another circle.

I want to rotate the black circle every 5 frames but not a transitional rotation rather every 5 frames it rotates to its new position (increments of 40 degrees, i.e. overlapping the blue circles) holds for 5 frames and repeats.

How do i got about achieving this?

Thanks


Return to posts index

Dan Ebberts
Re: Rotation with duration, holds for 1 sec. then repeats
on Apr 16, 2012 at 4:05:24 pm

This should work:

f = timeToFrames(time-inPoint);
value + Math.floor(f/5)*40

Dan



Return to posts index


George Judd
Re: Rotation with duration, holds for 1 sec. then repeats
on Oct 23, 2018 at 5:58:17 pm

Hey Dan,

I am trying to achieve a similar effect. However, I need my null to rotate 1 degree every 3 frames and that is all.

I have been trying to tweak your expression, but my limited understanding of expression hasn't got me very far!

If you had any recommendations on books or videos that would help me get a better grasp on expression I'd really appreciate it!

Many thanks!

George


Return to posts index

Dan Ebberts
Re: Rotation with duration, holds for 1 sec. then repeats
on Oct 23, 2018 at 7:55:18 pm

Try this:

f = timeToFrames(time-inPoint);
value + Math.floor(f/3)


Dan



Return to posts index

George Judd
Re: Rotation with duration, holds for 1 sec. then repeats
on Oct 24, 2018 at 8:36:05 am

Works like a dream, thank you ☺


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]