FORUMS: list search recent posts

time remapping with expression (?)

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
ido shor
time remapping with expression (?)
on Sep 7, 2016 at 7:06:37 am

Been trying to link the position of an Emitter (light) to a slider value, which changes every 25F. (getting it's value from a random expression)
I need to use the Linear expression so the value I get from the slider will translate to legit position value for the emitter. (that is a given fact...) what I got was a jumpy animation of the Emitter instead of a nice ease movement between each value change.

obviously it did that.... but I tried to take it from here and write something that will give it the interpolation I need in-between. thought maybe to use a time-remapping expression, but I am not sure that would be the solution.

any thoughts?

Tnx, Ido.


Return to posts index

Kalle Kannisto
Re: time remapping with expression (?)
on Sep 7, 2016 at 8:13:06 am

Use the ease() expression instead of linear() and you will get a smoother result. You can set it up to ease at each end of the range.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

ido shor
Re: time remapping with expression (?)
on Sep 7, 2016 at 10:47:09 am

yes, I actually didn't write my post properly.... I DID used the "Ease function" in my equation.
but it didn't change or solve my issue.

thanks anyhow Kalle.


Return to posts index


Kalle Kannisto
Re: time remapping with expression (?)
on Sep 7, 2016 at 12:55:08 pm

Do you mean you have an expression that changes the value suddenly every 25 frames (like a hold keyframe) but you need the emitter to move smoothly between the positions?

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

ido shor
Re: time remapping with expression (?)
on Sep 7, 2016 at 2:15:06 pm

yes, that is the case.
exactly.


Return to posts index

Dan Ebberts
Re: time remapping with expression (?)
on Sep 7, 2016 at 4:39:56 pm

Hard to say exactly, but probably something like this (not tested):

slider = ??; //(link to your slider here)
period = 25; // frames
tPeriod = framesToTime(25);
seg = Math.floor(time/tPeriod);
t = time%tPeriod;
v1 = slider.valueAtTime(seg*tPeriod);
v2 = slider.valueAtTime((seg+1)*tPeriod);
ease(t,0,tPeriod,v1,v2)


Dan



Return to posts index


ido shor
Re: time remapping with expression (?)
on Sep 10, 2016 at 10:37:41 am

Thanks Dan,

wiIll test that and come up with the results!

I can think of a few ways this script could come in handy...

cheers,
Ido


Return to posts index

ido shor
Re: time remapping with expression (?)
on Sep 10, 2016 at 8:32:43 pm

Ok, Here are my foundlings

a graphical view of the behaviour of this expression:



the white line is the random value of the slider (with a posterizeTime expression added to change the value only every nth frame).
the green line represent the interpolation expression on the position.Y axis of the layer.

correct me if I am wrong, but it seems that the expression is generating the interpolation between two keyframes over a period of 25f, and not every 25f.

since the change is happening only every 25f, it needs to calculate it only between the 25th frame and the 26th frame and so on.

how can we achieve that?

cheers, Ido.


Return to posts index

Dan Ebberts
Re: time remapping with expression (?)
on Sep 10, 2016 at 8:45:58 pm

You lost me. Can you draw what you want the result to look like?

Dan



Return to posts index


ido shor
Re: time remapping with expression (?)
on Sep 11, 2016 at 7:09:09 am

:)

sure Dan,
what I am aiming at here is building a graph that will step forward every 25f, getting it's values (the Y value that is), from a slider which has a random expression to it:

x = 25;
f = thisComp.frameDuration * x;
posterizeTime(1);
Math.round(random(300,600))

the object which generates the graph is an Emitter of Particles moving according to this expression.

so, I need this expression to get the values generated from the random slider, and add an ease interpolation, between each value change over a period of 25f. but at the same time, it has to keep still for 25f before moving on to the next keyframe.... (remember the steps?...)

that's basically it.

cheers,
Ido.


Return to posts index

Kalleheikki Kannisto
Re: time remapping with expression (?)
on Sep 11, 2016 at 7:39:02 am

I think you'd get that if you change the posterize time value to 2, at which it would interpolate for 25 frames and hold the value for another 25 frames for a total of 50 frames per step.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

ido shor
Re: time remapping with expression (?)
on Sep 11, 2016 at 7:55:01 am

Thanks K.

that wasn't the case, but it did made me think that maybe the interpolation time frame, (the time the ease in/out is taking) is just covering all the frames that I want it to stop...

reducing it to 5f like so did the trick:

slider = thisComp.layer("Null 1").effect("Slider Control")("Slider")
period = 25
tPeriod = framesToTime(5);// <---------------here
seg = Math.floor(time/tPeriod);
t = time%tPeriod;
v1 = slider.valueAtTime(seg*tPeriod);
v2 = slider.valueAtTime((seg+1)*tPeriod);
ease(t,0,tPeriod,v1,v2)

and gave me this beautiful result:



if I want to have the interpolation go above 25f, I need to get the slider's x value up:

x = 100; //<----- for example.
f = thisComp.frameDuration * x;
posterizeTime(1 / f);
Math.round(random(300,600))

so... thank to Dan again, and to K off-course.

cheers,
Ido.


Return to posts index

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