05. Make sure the null object is a 3D layer and set the slider to a value of 1. Twirl down the Transform Properties Disclosure arrow and Alt/Opt + click on the Position stopwatch. Add the following code, or copy and paste it from Step 5 on the cover CD: try{ currentVal = effect(“CurrentLayer”) (“Slider”); Min = Math.floor(currentVal); Max = Min+1; oldPosition = thisComp. layer(“layer”+Min).transform.position newPosition = this_comp. layer(“layer”+Max).transform.position; ease(currentVal, Min, Max, oldPosition, newPosition); } catch(err){}


06. Let’s break down the code. This expression is contained by a try{} catch(err){} statement. This deals with the scenario where we try to animate to a layer that doesn’t exist. The next line grabs the current value of the slider we added to the null object and uses it to select the layer we’re on, and the layer we’ll next move to. Finally, we store the position properties for the layer we’re moving away from and the layer we’re moving towards, and we use the built in ease() function to plot a course between the two according to the value of the slider.


07. The easiest way to understand this is to add a second text layer and animate the camera between the two layers. Duplicate ‘layer1’ (the new layer should be called ‘layer2’ automatically) then move this copy to a new position in 3D space. Now move to three seconds on the timeline and set a keyframe for the slider control. Make sure the slider is set to a value of 1. Move a second down the timeline and set the slider to 2. Now scrub the playhead back and forward to see your camera automatically animate between the two layers.