Monday, December 7, 2009

Week #14: Expressions

EXAMPLE#1: Pickwhip tool



What is an expression?
An expression is basically a Javascript line of code (scripts, set of instructions, formulas) used to generate and animate property values.

EXERCISE #1: Pickwhip Tool

We will use one layer's properties to control another layer's properties directly,
using the Pickwhip Tool.

STEPS:
1. Create Text
• Create text in a layer: "Blast Off".
• Create a layer with the words "into space".

2. Animate "Blast Off"
• In the layer with the text "Blast Off", in the Timeline Ruler, use two keyframes to animate the Opacity from 100% to 0% over 10 seconds. This will create a fade out.

OPTION and Drag the CTI to scrub through the animation.


3. Link the "Blast Off" animation to "into space" using the Pickwhip Tool
• In the layer with the text "into space", do the following:
1. Open up the property layers, and click on Opacity.
2. Hold OPTION and click on Opacity.
- reveals the expression in the Timeline Ruler;
- reveals a set of switches next to the property Opacity.
3. Click the Pickwhip (the swirl) and drag the Pickwhip to the Opacity property of the layer with the text "Blast Off".
RESULT: This links into space with Blast Off.
thisComp.layer("Blast Off").transform.opacity

4. Repeat this action with the Z Rotation and Scale
• Hold OPTION and click on the Property.
• Click the Pickwhip (the swirl) and drag the Pickwhip to the property .

thisComp.layer("Blast Off").transform.zRotation
thisComp.layer("Blast Off").transform.scale

---------------------------------------

Add a light,
Pickwhip the Light Intensity to the Scale property of Blast Off.
NOTE how the Scale goes from 100% to 0,
Now the Light Intensity goes from 100% to 0%. In other words it fades out.
So, one property value may control another different property value.

thisComp.layer("Blast Off").transform.scale[0]
is now in the Light Intensity expression
---------------------------------------

Add a camera,
Pickwhip the Camera Zoom to the Scale property of Blast Off.
NOTE how the Scale goes from 100% to 0,
Now the Camera Zoom goes from 100% to 0%. In other words, it zooms away.
So, one property value may control another different property value.

thisComp.layer("Blast Off").transform.scale[0]
is now in the Camera Zoom expression
---------------------------------------

Pickwhip the spacemen to the Blast Off property of Z Rotation
NOTE how the Z Rotation goes from 0 to -1x (in other words -360 degrees)
Now the Camera Zoom goes from 100% to 0%. In other words, it zooms away.
So, one property value may control another different property value.

thisComp.layer("Blast Off").transform.scale[0]
is now in the spacemen expression

EXAMPLE #2:Creating motion using an expression:


EXERCISE #2: Motion Using an Expression

1. Enable Time Remapping
Layer > Time > Enable Time Remapping

2. Apply the following expression to the Time Remap property layer
cycle = 4;
f = timeToFrames();
framesToTime(Math.floor)f/cycle) + f%cycle);



EXAMPLE #3: Audio triggering animation using Audio Amplitude:


EXERCISE #3:
SetUp
1. shape on a layer
2. Audio file with variable amplitude
3. Select the audio layer, then Animation > Keyframe Assistant > Convert Audio to Keyframes. This creates an Audio Amplitude layer

4. Apply the following script to the Scale property of the shape

minAudio = 0;
maxAudio = 20;
maxStretch = 4.0;

audioLev = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");

stretch = linear(audioLev, minAudio, maxAudio, 1.0, maxStretch);

value * stretch

No comments: