Activity › Forums › Adobe After Effects › Parenting layers for short amounts of time?
-
Parenting layers for short amounts of time?
Kevin Camp replied 18 years, 5 months ago 7 Members · 14 Replies
-
Kevin Camp
November 19, 2007 at 8:34 pmto get full control over pickup and setdown positioning, it seems easier to use layer markers (with layer selected hit the ‘*’ key) to control the position.
paste this into the position expression field:
target = thisComp.layer(“hand”).transform.position;
if (marker.numKeys < 2) { value } else { pickup = marker.key(1); setdown = marker.key(2); if (time <= pickup.time) target.valueAtTime(pickup.time); if ((time > pickup.time) && (time < setdown.time)) target; if (time >= setdown.time) target.valueAtTime(setdown.time);
}then add 2 markers to the layer. the first will be the pickup marker and the second will be the setdown marker.
Kevin Camp
Designer – KCPQ, KMYQ & KRCW -
Daniel Haskett
November 19, 2007 at 9:42 pmhey man,
thanks alot that works a treat and is so simple to do once the expression is in place with many different objects.
out of interest how would you add an offset into the expression? so maybe you could use a slider control to change the offset so the object moves around a little. i spose you could also use a wiggle for a more random effect. can u add a wiggle expression at the end? or an offset?
sorry im getting better with expressions, but not really found anywhere that teaches about doing long expressions!
cheers for your help,
dan
-
Kevin Camp
November 19, 2007 at 10:35 pmyep… you’d probably want 2 sliders, one for x and one for y. then your expression would be like this…
target = thisComp.layer(“hand”).transform.position;
xOffset = effect(“Slider Control”)(“Slider”);
yOffset = effect(“Slider Control 2”)(“Slider”);
if (marker.numKeys < 2) { value } else { pickup = marker.key(1); setdown = marker.key(2); if (time <= pickup.time) target.valueAtTime(pickup.time) + [xOffset, yOffset]; if ((time > pickup.time) && (time < setdown.time)) target + [xOffset, yOffset]; if (time >= setdown.time) target.valueAtTime(setdown.time) + [xOffset, yOffset];
}}
if you wanted some wiggle, you would probably need to add the wiggle expression to the slider values, either:
value + wiggle(1,5)
or just
wiggle(1,5)
Kevin Camp
Designer – KCPQ, KMYQ & KRCW -
Kevin Camp
November 20, 2007 at 3:35 pmactually, you could apply the wiggle expression to the anchor point, too…
Kevin Camp
Designer – KCPQ, KMYQ & KRCW
Reply to this Discussion! Login or Sign Up