ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

get time at a value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Amestane Tindi
get time at a value
on Jan 7, 2015 at 8:43:55 pm

Hi,
I know how to get a value at a time, but I want to get the time at a certain value, I have a layer A that has the scale sized from 0 to 100% by a sampleImage function from layer B, and I want it to fade out after it get to 100% scale, so I need to have the time where it happen(let's call this time value "st") to be able to do to opacity "100-(st-time)", example : A reach 100 scale at 50, so at this moment: opacity = 100-(50-50) = 100, and the more the time goes after that that more the A fade out, 100-50-60 ....

Thank you.

Regards,
Amstane.


Return to posts index

Dan Ebberts
Re: get time at a value
on Jan 7, 2015 at 11:18:53 pm

The best you can do is create a frame-by-frame loop that uses valueAtTime() to find the frame where the value reaches the threshold. You can start at the current frame and go backwards to find the most recent occurrence, or you can start at the earliest frame and go forwards to find the first occurrence. In either case you need to have logic to handle the possibility that it hasn't happened yet.

Dan



Return to posts index

Amestane Tindi
Re: get time at a value
on Jan 8, 2015 at 1:11:01 am

Hi,
Thanks Dan for your quick response.
However I can't do that my, the animation that trigger the other is automatic, no key-frames, it use sample image to see when to start, and I want to trigger the decrease animation when this scale one finish.

I'll try to tell it other way.

Is there a way to make a decrease animation other way than with x-time technique ?

Thanks a lot.

Amstane.

Regards,
Amstane.


Return to posts index


Dan Ebberts
Re: get time at a value
on Jan 8, 2015 at 1:20:34 am

> the animation that trigger the other is automatic, no key-frames

That shouldn't matter (unless I completely misunderstand what you've trying to do).

If you want to find the time when the scale hit 100% (%99.99 would probably be safer), valueAtTime() is the way to do it. The idea is really similar to this:

http://www.motionscript.com/design-guide/audio-trigger.html


Dan



Return to posts index

Amestane Tindi
Re: get time at a value
on Jan 8, 2015 at 1:51:23 am

I've found a temporarily solution, (below)
But I'll defiantly check yours tomorrow, seems complicated right now, but I'll look deep into it.

I used the scale animation reach 100% at 0.9 instead of 1 and kept the 0.1 for the glow effect that I'm applying on the layer.

Amstane

s=thisComp.layer("Animation Guide"); // the layer with the wipe animation that will be sampled
sc=transform.scale[0]/100; // the scale depend already of the animation guide sampling from 0 to 0.9
scL=linear(sc,0.5,1,0,1); // to have the glow start at scale 50
v=s.sampleImage([transform.position[0],transform.position[1]],[.5, .5]); // sampling again nut from 0.9 to 1
e=layer("ANIMATION").effect("Assembling Glow")(1)*scL; // control the glow max value with a slider
ease(v[0],0.9,1,e,0) // While sampling goes from 0.9 to 1 the glow goes from e to 0


Regards,
Amstane.


Return to posts index

Maria Ciszynska
Re: get time at a value
on Jan 5, 2018 at 3:14:37 pm

I know this thread is old but I have a similar problem and my knowledge of expressions is very basic. So any help greatly appreciated!

I have a layer which goes from point A to point B, for which I want to create a 1 second overshoot of sorts, so that when it reaches B it moves back a bit.

The movement is all automated with no keyframes as it's linked to reveal of a text, so I only have value of B and value after overshoot. I would like to use an Ease expression on it, but I'm missing how to make it last 1 second and start after layer arrives at B. Any thoughts?

Many Thanks,

x=transform.xPosition;
h=thisComp.layer("Dot").effect("Slider Control")("Slider");
b=thisComp.layer("END OF TEXT").transform.position[0];
o=thisComp.layer("OVERSHOOT").transform.position[0];
minVal=g;
maxVal=g+o;
h1=(h==g);
if (h<g) {
x=h
} else {
easeOut(time,h1.time,(h1.time+1),minVal,maxVal)
}


Return to posts index

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