Page 1 of 1

### Increment Rotation At Markers

Posted: May 12th, 2008, 10:27 am
This expression will increase (and animate) the rotation by the user defined number or degrees at every marker on the layer. If you set the duration to anything more than 0 the rotation will animate into the marker. In other words it will start the rotation f frames before the marker and it will finish the rotation at the marker.

Code: Select all

``````
f=5; //duration in frames of rotation, set to zero if you want it to click
d=20; //degrees to rotate

f=framesToTime(f, fps = 1.0 / thisComp.frameDuration);
n = 0;
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (time > marker.key(n).time && n < marker.numKeys){
n++;
}
r=(d*(n-1)) + value;
linear (time,marker.key(n).time-f,marker.key(n).time,r,r+d);
}
``````
-Lloyd

### Re: Increment Rotation At Markers

Posted: May 14th, 2008, 8:34 am
This expression will oscillate rotation back and forth at markers:

Code: Select all

``````f=5; //duration in frames of rotation, set to zero if you want it to click
d=20; //degrees to rotate

r=value;
f=framesToTime(f, fps = 1.0 / thisComp.frameDuration);
n = 0;
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (n%2) {d=d*-1; r=r-d;}
linear (time,marker.key(n).time-f,marker.key(n).time,r,r+d);
}
``````

### Re: Increment Rotation At Markers

Posted: June 16th, 2008, 11:27 am
Hey Lloyd

This might come in handy for me on a current project. How would you combine this with a wiggle? ie if I wanted the wiggle to increase based on your script?

Thanks
Alex

### Re: Increment Rotation At Markers

Posted: June 16th, 2008, 12:01 pm
you want the amount of wiggle to increase at each marker?

### Re: Increment Rotation At Markers

Posted: June 16th, 2008, 12:15 pm
Yes, sorry if I wasn't clear. I'm basically trying to find ways to control the evolution of a wiggle parametrically, ie without keyframes from a slider. Markers are one good way I hadn't thought of...

Thanks!
Alex

### Re: Increment Rotation At Markers

Posted: June 16th, 2008, 1:36 pm

Code: Select all

``````freq=24; //wiggle frequency in frames per second
s=0; //wiggle start amount
d=20; //amount to increase wiggle at each marker
f=15;  //duration in frames of transition to next amount, set to zero if you want it to click

f=framesToTime(f, fps = 1.0 / thisComp.frameDuration);
n = value;
if (marker.numKeys > 0){
Â  n = marker.nearestKey(time).index;
Â  if (time > marker.key(n).time && n < marker.numKeys){
Â  Â n++;
Â  }
r=(d*(n-1))+s;
a=linear (time,marker.key(n).time-f,marker.key(n).time,r,r+d);
wiggle(freq,a);

}``````

### Re: Increment Rotation At Markers

Posted: June 17th, 2008, 9:43 am
Can this be used with audio somehow?

Ideally to rotate on the beat. I often have the raw tracks for music, such as only the kick or only the snare fairly well isolated.

### Re: Increment Rotation At Markers

Posted: June 17th, 2008, 10:15 am
totally, that's what I wrote it for in the first place.. simply place markers on your layer at every beat..

if you want a more automated way to do that, you can reference this tutorial by Dan: http://www.motionscript.com/design-guid ... igger.html

and feed my expression the threshold time instead of the marker time. But in my experience i get better results when I mark the beats myself.. at least use Trapcode's soundkeys which can let you isolate frequencies better.

-lloyd