ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

keyframe to Linear

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ilya Sire
keyframe to Linear
on Jan 16, 2017 at 6:26:54 pm

Hello forum,

i found this thread here https://forums.creativecow.net/thread/227/18998
i have 2 keyframes on other layer (null)
and apply this expression to other layer opacity

how i can maintain last value to 0

currently this code set back to 100.
Please help. Thank you

ilya

p=thisComp.layer("null").effect("keyframe")("Slider") // two keyframes
v = 100;

if (p.numKeys > 0){
n = p.nearestKey(time).index;
if (p.key(n).time > time) n--;
if (n > 0 && n &lt; p.numKeys)
v = linear(time,p.key(n).time,p.key(n+1).time,100,0); // it get back to 100 after time past last keyframe??
}
v


Return to posts index

Dan Ebberts
Re: keyframe to Linear
on Jan 16, 2017 at 6:53:00 pm

This should work:


p=thisComp.layer("null").effect("keyframe")("Slider") // two keyframes
v = 100;

if (p.numKeys > 0){
n = p.nearestKey(time).index;
if (p.key(n).time > time) n--;
if (n > 0){
if (n < p.numKeys){
v = linear(time,p.key(n).time,p.key(n+1).time,100,0);
}else{
v = 0;
}
}
}
v



Dan



Return to posts index

Ilya Sire
Re: keyframe to Linear
on Jan 17, 2017 at 3:28:20 am

Thank you for helping me... it worked!


Return to posts index

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