ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Using valueAtTime expression with a position

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Craig Ricker
Using valueAtTime expression with a position
on Jul 26, 2011 at 7:07:03 am

Hi there,

Basically I have a layer using the valueAtTime(time-1) expression on another layers position. I want it to only do this say from 1-5 seconds, and then I would like it to stop, so I can keyframe the position from then on. Is there a way of writing this through expressions, or must I end the layer at the 5 second mark, and start a new layer that I can keyframe that picks up from where it left off?
Hope that made sense


Return to posts index

Greg Burrus
Re: Using valueAtTime expression with a position
on Jul 26, 2011 at 4:02:59 pm

I think you maybe be able to use expression timeline script http://aescripts.com/expression-timeline/. Another option would be to right a if statement to tell it to on work up to a certain frame which is essentially what the script does but automatically.

However I'm thinking that when you switch it off the layer following may jump to the position it was at originally before it started following. So you may want to try another approach that will let it stay at it's last position.


hope this helps

Greg

http://mogra.g2bproductions.com/ - Blog
http://g2bproductions.com/ - Portfolio


Return to posts index

Dan Ebberts
Re: Using valueAtTime expression with a position
on Jul 26, 2011 at 4:41:58 pm

Something like this, probably:


timeToStop = 5;
if (time < timeToStop){
(your expression goes here)
}else{
value
}



Dan



Return to posts index


Craig Ricker
Re: Using valueAtTime expression with a position
on Jul 27, 2011 at 1:59:48 am

Thanks for the replies guys.

Ok so I want to make it a little more complicated and I wonder if this is possible.
What I would like is this.

Object A follows object B using
timeToStop = 6.5;
if (time < timeToStop)
{thisComp.layer("Shape Layer 1").transform.position.valueAtTime(time-1)}
else{
}
At 6.5 Object A continues on, and I would like Object B to follow but I would like it to gradually (say over the next 1 second) add 5 to the x value of the position of Object B.


So at 6.5 seconds the following would be true
Object A position [0,0]
Object B position [0,0]

And at the end of that next second (7.5) the following would be true
Object A position [5,10]
Object B position [10,10]

How can I go about gradually incrementing the X position of object B whilst still having it follow Object A?


Return to posts index

Dan Ebberts
Re: Using valueAtTime expression with a position
on Jul 27, 2011 at 3:31:42 am

So after 6.5 seconds the follower is still following but acquires a 5-pixel x offset over one second, is that correct? If so, that could look like this:


timeToStop = 6.5;
if (time < timeToStop){
thisComp.layer("Shape Layer 1").transform.position.valueAtTime(time-1)
}else{
xOffset = ease(time,timeToStop,timeToStop+1,0,1);
thisComp.layer("Shape Layer 1").transform.position.valueAtTime(time-1) + [xOffset,0]
}


But this is simpler and does the same thing:


timeToStop = 6.5;
xOffset = ease(time,timeToStop,timeToStop+1,0,1);
thisComp.layer("Shape Layer 1").transform.position.valueAtTime(time-1) + [xOffset,0]



Dan



Return to posts index

Craig Ricker
Re: Using valueAtTime expression with a position
on Jul 27, 2011 at 6:31:16 am

Brilliant! Learning heaps, thanks!


Return to posts index

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