# Expressions

## Joe Clay | Jan 25, 2016

Here are some of the useful expressions included with Quiver.

``````//Autofade: Add to opacity
transition = 8;       // transition time in frames
if (marker.numKeys<2){
tSecs = transition / ( 1 / thisComp.frameDuration); // convert to seconds
linear(time, inPoint, inPoint + tSecs, 0, 100) - linear(time, outPoint - tSecs, outPoint, 0, 100)
}else{
linear(time, inPoint, marker.key(1).time, 0, 100) - linear(time, marker.key(2).time, outPoint, 0, 100)
}``````
``````//Countdown Timer (apply to Source Text)
t = Math.floor(time);
s = 240 - t;
minutes = Math.floor(s/60);
seconds = s-(minutes*60);
if(seconds < 10)
{
seconds = '0' + seconds;
}
minutes + ':' + seconds;``````
``````//Inertial bounce
amp = .1;
freq = 2.0;
decay = 2.0;
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}}
if (n == 0){ t = 0;
}else{
t = time - key(n).time;
}
if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{value}``````
``````//Apply to Time Remap
pos = transform.position;
delay = -1; //in seconds
x = Math.pow(pos[0]-960,2);
y = Math.pow(pos[1]-540,2);
d = Math.sqrt(x+y);
value + linear(d,0,1102,0,delay);``````
``````// Spin (rotate at a constant speed without keyframes)
veloc = 360; //rotational velocity (degrees per second)
r = rotation + (time - inPoint) *veloc;
[r];``````
``````//Moves things in a spiral (apply to position)
center=[thisComp.width/2,thisComp.height/2];
decay = 0.3; //decay
freq = 6; //frequency
aStart = 0; //start angle offset
aRate = 220; //rotation rate
offsetFactor = 1000; //smoothness
r = rMax/Math.exp(time*decay);
offset = (r/offsetFactor)*Math.sin(freq*time*Math.PI*2);center + [Math.cos(a),Math.sin(a)]*(r + offset);``````
``````// Throw (move at a constant speed without keyframes)
veloc = -10; //horizontal velocity (pixels per second)
x = position[0] + (time - inPoint) *veloc;
y = position[1];
[x,y];``````

I hope these scripts can help you out in your work! Keep an eye on this section for more useful tools!

## Become a Patron

If you'd like to help support Workbench, check out our Patreon page. For \$5 a month, you get access to all of the tutorial project files we've made available as well as other monthly projects, rigs, R&D, elements, early product previews, and BTS content not available anywhere else!