Escolar Documentos
Profissional Documentos
Cultura Documentos
michael natk in, fr ed lew is, dan ebberts, br ian maffitt & steve holmes
CI RC LE FU N
by Michael Natkin & Brian Maffitt
This generates perfect circular motion centered around the original position of the layer. I recommend that you map the radius and cycle inputs to Expression Control sliders, and the phase input to an Expression Control angle. Apply this expression to the position of the layer.
radius = 75; // the radius of the circle cycle = 1; // number of seconds to complete a circle; higher value = slower if(cycle ==0){cycle = 0.001;} //avoids a "divide by zero" error phase = 27; // initial angle in degrees from bottom reverse = 1; // 1 for ccw, -1 for cw x = Math.sin( reverse * degrees_to_radians(time * 360 / cycle + phase)); y = Math.cos(degrees_to_radians(time * 360 / cycle + phase)); add(mul(radius, [x, y]), position)
T R ACK A CH I LD
by Michael Natkin
This expression is designed to track the position of a layer that has been parented to one or more layers. Use the expression below on the position property that you wish to animate, changing the name Child to match the name of the layer you wish to track. For instance, if you want to use write-on to track the position of a layer called moon, apply this expression to the brush position property of the write-on filter, and change child to moon.
c = this_comp.layer("child"); c.to_comp(c.anchor_point)
BOU NCE
by Michael Natkin & Brian Maffitt
Creates a bouncing (sine wave) motion between two specified 2-dimensional positions over a specified period of time (in seconds). Useful for creating bouncing balls. Use Expression Control position points for from, to, and an Expression Control slider assigned to period for fine control. You can apply these to any layer.
surface = [320, 480]; //the position of the "bounce" surface apogee = [320, 50]; //the "apogee" of the bounce period = 1.5; //the length of time from surface to apogee t = time % (period * 2); if (t > period) t = 2 * period - t; linear(Math.sin(t * Math.PI / period), 0, 1, surface, apogee)
2D LOOK AT
by Fred Lewis
Apply this Expression to the Rotation channel of any layer you wish to control. Set LookAt, below, to the name of the layer you wish the layer to look at. If the controlled layer is not initially pointing straight up, enter an offset amount in degrees, below, to adjust the direction it is looking.
LookAt = ball offset = 0 diffx = position[0] - this_comp.layer(LookAt).position[0]; diffy = position[1] - this_comp.layer(LookAt).position[1]; if (diffx == 0) { diffx = 1 } sign = 1 + (-1 * (diffx / Math.abs(diffx))) * 90; radians_to_degrees(Math.atan(diffy/diffx)) + sign + offset
3D LOOK AT
by Fred Lewis
Apply this expression to the orientation channel of the layer you wish to have look at another layer (the layer being controlled). Enter the name of the layer to look at in LookAt below. If the layer being controlled does not correctly look at other layer, adjust the layer offset by changing the X, Y and Z rotation values (not the orientation values) for the layer being controlled.
LookAt = "ball" look = look_at(position, this_comp.layer(LookAt).position); [look[0], look[1], look[2]]
A NGLE OF V I EW ZOOMER
by Fred Lewis
This allows you to control the angle of view of a camera interactively, by scaling a null object on screen. To use: Create a null called angle_zoomer. Animate the nulls scale to control viewing angle in degrees.
substitute = this_comp.layer("angle_zoomer").scale[1]; this_comp.width / (2 * Math.tan(degrees_to_radians(substitute/2)))
CA MER A AUTOFOCUS
by Fred Lewis
Apply this expression to the Focus Distance of your camera, then change the name Focus Layer below, to the name of the layer you wish to keep in focus.
focuser = "Focus Layer"; cam_to_layer = sub(this_comp.layer(focuser).position, position); length(cam_to_layer)
CON N ECTOR
by Fred Lewis
These Expressions can be used to make a connector that stretches like a rubber band between two layers, which by default are named End 1 and End 2. Obviously you can change these names to anything you like. The connector layer wants to be a horizontal rectangle, with the anchor point of the layer moved to the left center edge of the layer. The connector has 3 separate expressions applied to it: one for position, one for rotation and one for scale. The Expressions are listed separately below.
// apply this Expression to the Connector layers Position parameter // set follow1 below to the name of the first layer to follow follow1 = "End 1" this_comp.layer(follow1).position // apply this Expression to Connector layers Rotation parameter // set follow2 below to the name of second layer to follow follow2 = "End 2" diff = sub(position,this_comp.layer(follow2).position); (Math.atan2(diff[1],diff[0]) * 180/Math.PI) + 180 // apply this Expression to Connector layers Scale parameter // set follow2 below to the name of second layer to follow follow2 = "End 2" stretch = length(position,this_comp.layer(follow2).position); [stretch,scale[1]];
GEA R S
by Fred Lewis
This Expression causes one gear to rotate at the proper speed when a second gear next to it is rotated, so that the two gears stay meshed with each other. To use this expression, first create and import two gears that mesh together properly. In order for two gears to mesh properly, the ratio of the difference in size between the two gears must equal the ratio of the difference in the number of teeth between the two gears. Once imported, decide which gear will be the Leader and which will be the Follower. Apply the Expression below to the Rotation parameter of the Follower gear. Then set the LayerToFollow, in the Expression, to the name of the Leader gear. Set the Ratio in the expression to the size of the Leader, relative to the Follower.
LayerToFollow = "Leader"; Ratio = 3/4 mul((this_comp.layer(LayerToFollow).rotation) * Ratio, -1)
x = Math.sin( reverse * degrees_to_radians(time * 360 / cycle + phase)); y = Math.cos(degrees_to_radians(time * 360 / cycle + phase)); add(mul(radius, [x, y]), position)
T EM POR A RY PA R EN T I NG
by Fred Lewis
Using the analogy of an eagle picking up a fish and dropping it in a nest, these two expressions can be used to parent one layer to another for only a portion of a longer animation. 1. Apply the first expression below to the position channel for a null. Set layertofollow to name of eagle layer. Set pickup and dropoff time values to times for pickup and dropoff, in seconds. 2. Apply the second expression to the rotation channel for the null. Set layertofollow to name of eagle layer. Set pickup and dropoff time values to times for pickup and dropoff, in seconds.
pickuptime = 1.53333; dropofftime = 5.0; layertofollow = "eagle" ticker = Math.min(Math.max(pickuptime, time), dropofftime); this_comp.layer(layertofollow).position.value_at_time(ticker) pickuptime = 1.53333; dropofftime = 5.0; layertofollow = "eagle" ticker = Math.min(Math.max(pickuptime, time), dropofftime); this_comp.layer(layertofollow).rotation.value_at_time(ticker)
LayerToFollow = "Corner Pinned Layer"; EffectToFollow = "Corner Pin"; ParamToFollow = Lower Right; effectlayer = this_comp.layer(LayerToFollow) effectparam = effectlayer.effect(EffectToFollow).param(ParamToFollow); layposx = effectlayer.position[0]; laywid = effectlayer.width; layheit = effectlayer.height; layposy = effectlayer.position[1]; effectposx = effectparam[0]; effectposy = effectparam[1]; [(layposx + effectposx - (.5 * laywid)), (layposy + effectposy - (.5 * layheit))]
DECAY I NG BOU NC E
by Dan Ebberts & Steve Holmes
This expression allows you to drop a layer from the top of the screen and have it bounce in the center of the comp as if tied to a string, with a bounce decay control. First, create a small solid called Control Layer and hide it in the timeline. Add 3 Slider Control effects, naming them velo control, amplitude control and decay control. Suggested initial slider values for each are -200, -200 and 4 respectively. Paste the expression below into the Position property of the layer you wish to bounce, and be sure to set the layers anchor point to the correct location, such as the bottom edge if dropping from the top.
veloc = thisComp.layer("Control Layer").effect("velo control")("Slider"); amplitude = thisComp.layer("Control Layer").effect("amplitude control")("Slider"); decay = thisComp.layer("Control Layer").effect("decay control")("Slider"); y = amplitude*Math.cos(veloc*time)/Math.exp(decay*time); value + [0,y]