ADOBE AFTER EFFECTS: Forum Expressions Tutorials Podcasts Creative Cloud Debate

Looping and/or retiming values controlled by an expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Michael MaulerLooping and/or retiming values controlled by an expression
by on Jun 19, 2012 at 5:44:04 pm

Hi everybody,

maybe you can help me solving a problem I can´t get my head around.
Basically I´m referencing the global positon of a light in my mastercomp to a null in another comp via layerspace transform (the "master" light is a child itself).
Now I´d like to speed up the original animation and repeat it, resulting in my null following the motionpath of the "master" light in my maincomp in a fraction of the time, jumping back an starting again.
I archieved a speedup by using valueAtTime(t*factor) but had absolutely no success in looping the retimed animation.
Maybe someone has an idea how to solve this problem, retiming a precomp is unfortunately no option, as I need the position in 3D to feed an emitter :(

Kind regards, Michael


Return to posts index

Dan EbbertsRe: Looping and/or retiming values controlled by an expression
by on Jun 19, 2012 at 6:34:11 pm

I would guess you could do it with JavaScript's modulus operator if you knew the maximum time where you wanted the looping to start. Something like:

(t*factor)%maxTime


Dan



Return to posts index

Michael MaulerRe: Looping and/or retiming values controlled by an expression
by on Jun 19, 2012 at 6:56:54 pm

Hi Dan,

thanks a bunch for your prompt reply!
I´ll give it a try and will post the whole expression as soon as i get it working... or cry for help again^^
With maxTime you´re refering to the end of the animation in the maincomp I think? So I could retrieve it via a marker hopefully (being lazy like always ;)

Greets, Michael


Return to posts index


Michael MaulerRe: Looping and/or retiming values controlled by an expression
by on Jun 19, 2012 at 10:03:57 pm

Worked like a charm!
Thank you again Dan, you´re the brain^^
This is what I came up with, looks rocksolid so far:

speedFac = 4;
refLayer = comp("refcomp").layer("refAni");
refPos = refLayer.transform.position;
keyCount = refLayer.transform.position.numKeys;
maxTime = refLayer.transform.position.key(keyCount).time;
refPos.valueAtTime((time*speedFac) % maxTime)


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2016 CreativeCOW.net All Rights Reserved
[TOP]