View Full Version : delay effect... value at time expression

04-18-2008, 06:54 PM
couldnt find a way to use it in expressions because i cant use the getAttr -t method.

this is the idea (valueAtTime is a method from after effects)
object1.tx = objetct.tx.valueAtTime(time-1)

the object1 would get the object x value at an especific frame.

How to work around this in expressions?

thanks a lot!!

04-19-2008, 03:16 PM
Can you send the expression I can't understand why you can't use getAttr -t !!! It's a valid expression .

if it's direct linking that u'r worried about use a fake link into a dummy var.

You can always use the silly method of changing the currentTime then getting the attribute .

04-19-2008, 11:06 PM
take two spheres: sphere1 ; sphere2.

Supose i had animated the y translation for the sphere1, so it goes up and down.
now i go back to the frame 1, where the two spheres have the same value for Y axis.

I want the sphere2 to follow sphere1 as an echo.
In after effects, this would work with the 'sphere1.position[1].valueAtTime(time - delay)' ...in 3ds, it would work with the 'at time (currenttime - delay) $sphere1.posY' ;

To get this in maya, im currently doing this:
Taking the sphere2.Y value in channel mode > expression editor >
and trying to write a code where i cant use "getAttr" method...

I cant use the script editor to write a mel to run for each frame playing, right?


04-20-2008, 10:12 AM
the thing is that U CAN use getAttr in the expression editor !

put this in the expression editor for Sphere2.ty :

int $delay=4;
int $t=`currentTime -q`;
Sphere2.translateY=`getAttr -t ($t-$delay) Sphere1.ty`;

04-20-2008, 09:44 PM

don't know if you are using windows... but if you are you could try this plugin lagnode (http://www.strarup.net/maya/plugins/lagNode/)...

otherwise if you need to get the value at other frames you can use the frameCache Node which also can be used in expressions...
can't remember the syntax for it at the moment but take a look at it in the Maya Help file docs... do a search for frameCache... :)

what you then need to do is create a frameCache node... connecting that to the attribute on the object you want to monitor... and then call the frameCache node value in the expression you create...

however if you're on windows it's much easier just to use the lagnode... then you don't need to write an expression either... :)

kind regards


this link might be useful and gives some info if using the frameCache Node --> LINK (http://claudiaherbst.org/cg517/frameCache/frameCache.html)

04-22-2008, 05:40 AM

don't know if you are using windows... but if you are you could try this plugin lagnode (http://www.strarup.net/maya/plugins/lagNode/)...

Nice dude , but I don't see how is that different from writing an expression , yes it can be faster but then you'll have to install the plug-in on every machine and on the render farm which could be a hassle

04-22-2008, 08:00 AM
Hi Wajdy,

well yeah... it depends... if it's just one attribute you need to monitor... and the time difference is going to be the same... then it might be a overflow of unnessary features you unleash by using the plugin for one attribute only... :D

hmm... well you can keyframe the values of the lagNode... you can play with the values of the lagNode to get the desired effect based on the time difference you want... instead of keep going into the expression editor and change the values... and let's say you want to in some frames have a time difference of 6 frames and a bit later only 4 frames... with the lagNode you can just set a key... which will save you a lot of mombo jumbo in the expression editor with exceptions loops etc.

well using the lagNode was just an idea... using getAttr -t which is a mel command... I would avoid using melcommands in expressions... I might just be environmentally brain damaged... where as I have learned.... using mel commands in a expression is a very bad idea... avoid it if you can and try solve it an other way if posible...
in this case if using expression you can use the frameCache node for this specific task made for getting values at other frames than the current one...

however I kinda still wonder why Alias at the time... and now Autodesk hasn't implemented these functions into Maya... since I made this plugin back in 2004 (http://forums.cgsociety.org/showthread.php?t=156962)...
and there is still only the frameCache node thingie availible...

I find the frameCache node quite limited and anoying... which was why I made the lagNode...

but jup ofcause you would need the plugin on the machines running the scenes... render farm etc. and if in a Linux environment where the plugin hasn't yet been made for... that could give a problem...
however could be solved by baking the animation out on the objects before throwning it on the renderfarm... :)

but if only for one object and only one attribute to monitor and getting the values for... sure the frameCache might suit that purpose better... :)

kind regards


CGTalk Moderation
04-22-2008, 08:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.