ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Dan Ebberts wonderful expressions

FAQ   •   VIEW ALL
 Dan Ebberts wonderful expressions on Apr 22, 2020 at 4:30:26 pm

Hello I try to combine 2 expressions from Mr Ebberts that found on this forum
but I am to stupid
What I want to achieve is that I can control the in point and the duration of a 4 Keyframe Opacity animation

for the In point I found this nugget

A = effect("in Point")("Schieberegler");
delta = A ;
valueAtTime(time - A)

and for the duration in found this nugget

ip = effect("Duration")("Schieberegler");
d = key(numKeys).time - key(numKeys-1).time;
if (time > (ip - d)){
t = key(numKeys-1).time + (time - (ip - d));
}else{
t = Math.min(time,key(numKeys-1).time);
}
valueAtTime(t)

individually they work great but as I said I am to stupid to make them both work
together
Please excuse my English its not my first language
And I want to thank Mr Ebberts for sharing his knowledge I learnt a lot over the years from his forum posts and his old homepage but obviously not enough

 Re: Dan Ebberts wonderful expressionson Apr 22, 2020 at 4:51:25 pm

Something like this should let you control the start of the keyframe sequence with the In Point slider, and the duration with the Duration slider:

``` ip = effect("In Point")("Schieberegler"); d = effect("Duration")("Schieberegler"); if (time < ip){ key(1).value }else if (time < ip + d){ t = linear(time-ip,0,d,key(1).time,key(numKeys).time); valueAtTime(t) }else{ key(numKeys).value } Dan ```

 Re: Dan Ebberts wonderful expressionson Apr 22, 2020 at 5:41:20 pm

Thank you of course does it work.
there is one small thing the opacity animations was meant to switch the layer on and of so I keyframed frame 0 with value 0, frame 1 with value 100, frame 2 with value 100 and frame 3 with value 0 again.
your expression seems to interpolate this into a dissolve of 25 frames
but that is okay for me. I will try to figure it out myself.
Actually I just found out was it was. I had to separate the in and out animation for about 4 seconds and now it just switches the layer on and off just like
I needed it to be.
Thank you a lot
you really helped me.
have a nice day