ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

how to animate a value from a specific point in time?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Assaf Goldlust
how to animate a value from a specific point in time?
on Aug 5, 2017 at 10:52:12 pm
Last Edited By Assaf Goldlust on Aug 5, 2017 at 11:03:12 pm

So here is a challenge that im facing right now I can use some help.
Im trying to use an expression to make a value stay on zero until a certain point of time
And then make it start animating from zero to the end.

The trick is: it should be something that can be easily modifiable.
So I can easily change the time were its supposed to start animating.

Any suggestions?


Return to posts index

Dan Ebberts
Re: how to animate a value from a specific point in time?
on Aug 6, 2017 at 1:05:13 am

It's hard to say exactly without knowing more about your animation, but in general, it will probably be something like this:


tStart = 3; // animation start time
if (time < tStart){
0;
}else{
// your animation here
}


Depending on what you're doing, you may have to adjust your animation code to use (time-tStart) instead of time.

You could connect tStart to a slider to make it easier to adjust the start time.


Dan



Return to posts index

Assaf Goldlust
Re: how to animate a value from a specific point in time?
on Aug 6, 2017 at 8:48:54 pm

Pritty much what i did but still missing the part that may help me.
I will be more elobirate on this one.

Im making an animation of slides that are moving from point of the frame to the other.
inside those each of those slides there is a footage.
i want this footage to stay on freeze frame and start playing only when the slide he is in has reached a specific position (i know i
originaly wanted to start moving when the CTI is has reached a certain time, but i made changes to the project)


is there any way to pull this off?


Return to posts index


Dan Ebberts
Re: how to animate a value from a specific point in time?
on Aug 6, 2017 at 10:58:42 pm

Here's a simple example where a time remapped layer should start playing when it reaches 500 px in the x direction:


xPos = 500;
if (position[0] < xPos){
0;
}else{
t = time;
while (t >= 0){
if (position.valueAtTime(t)[0] < xPos){
break;
}
t -= thisComp.frameDuration;
}
if (t > 0)
time - t
else
0;
}



Dan



Return to posts index

Assaf Goldlust
Re: how to animate a value from a specific point in time?
on Aug 14, 2017 at 8:00:04 am

I hope im not breaking any rule with a such delayed reply
but im having a problem.

Since im trying to understand what makes the expressions i im using tick.
I tried to learn this "while/do statement" and while trying to test it i ran into an error i have never seen before,

"Timeout while waiting for the engine Expression disabled"

Any idears about what does it mean
and how do i solve it?

Also this is the expression i wrote while making the test

(R=transform.rotation;

T=time;

while(T<3){R+1}


Return to posts index

Dan Ebberts
Re: how to animate a value from a specific point in time?
on Aug 14, 2017 at 1:18:22 pm

On any frame within the first three seconds of the comp, your expression will keep calculating the value of rotation plus one until the expression engine times out because the condition that would stop the while() never occurs.

Dan



Return to posts index


Assaf Goldlust
Re: how to animate a value from a specific point in time?
on Aug 14, 2017 at 7:31:58 pm

So lets see if i undrstood correctly:
the problem is that the exression dont have a defined comand about what to do when the condition to the loop is false?


Return to posts index

Dan Ebberts
Re: how to animate a value from a specific point in time?
on Aug 14, 2017 at 7:47:22 pm

No, it's that your while() will loop endlessly (until it times out) because the false condition never happens (for any frame within the first three seconds)

What is it that you want the expression to do? If you want the rotation to increment 1 degree every frame for three seconds, that would be something like this:

f = timeToFrames(Math.min(time,3));
value + f

Since expressions have no memory and no info can be passed from one frame to the next, you have to calculate the result based on the current time/frame.

Dan



Return to posts index

Assaf Goldlust
Re: how to animate a value from a specific point in time?
on Aug 14, 2017 at 9:03:51 pm


What is it that you want the expression to do? If you want the rotation to increment 1 degree every frame for three seconds, that would be something like this:

yes and no...that what i was trying to do but only as a way to try to understand the "while do loop"



No, it's that your while() will loop endlessly (until it times out) because the false condition never happens (for any frame within the first three seconds)


So let me see i got this right:
becuse expressions has no memory he keep calculating the loop on every frame and becuse the condition is never false untill three second its just loops endlessy on the each frame untill its times out?

i dont get it: isent the whole purpose of "while do loop" is to get something to loop untill the condition becomes false?

dosent that makes the expression unsuable?

if it is how do i use it properly?


Return to posts index


Dan Ebberts
Re: how to animate a value from a specific point in time?
on Aug 14, 2017 at 9:26:35 pm

Here's an example of an incremental counter that holds each value a random amount of time (somewhere between 1 and 3 seconds):


seedRandom(index,true);
t = 0;
count = -1;
while(t <= time){
t += random(1,3);
count++;
}
count



Dan



Return to posts index

Dan Ebberts
Re: how to animate a value from a specific point in time?
on Aug 14, 2017 at 9:36:41 pm

The key is that since you can't pass infomation from frame to frame, when dealing with random durations, you use the while() loop to recreate everything that has occured on past frames so you know what the current state should be.

Dan



Return to posts index

Assaf Goldlust
Re: how to animate a value from a specific point in time?
on Aug 16, 2017 at 7:38:42 am

at this point i think this two advance for me. i will step back untill i will learn the fields of expression more threoughly thanks for your help


Return to posts index

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