FORUMS: list search recent posts

multiple linear() expressions in a row

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alex Weil
multiple linear() expressions in a row
on Jan 17, 2020 at 4:54:26 pm

hey guys

i have a slider and several position keyframes (on a null). now i want to move from key(1) to key(2) when slider slides from 0 - 25 ... no problem ... but from 25-50 it should move from key(2) to key(3) ... okay second linear() expression... i multiplied it all like this:

s = effect("Slider Control")("Slider");
p = transform.position;
linear(s,0,25,p.key(1),p.key(2))+
linear(s,25,50,p.key(2),p.key(3))+
linear(s,50,75,p.key(3),p.key(4))+
linear(s,75,100,p.key(4),p.key(5))


so i summarized the linear expressions together but then my null goes crazy like all the key() get summarized :-/


Return to posts index

Dan Ebberts
Re: multiple linear() expressions in a row
on Jan 17, 2020 at 5:33:45 pm

See if this works for you:


s = effect("Slider Control")("Slider").value;
if (s <= 25){
t = linear(s,0,25,key(1).time,key(2).time);
}else if (s <=50){
t = linear(s,25,50,key(2).time,key(3).time);
}else if (s <= 75){
t = linear(s,50,75,key(3).time,key(4).time);
}else{
t = linear(s,75,100,key(4).time,key(5).time);
}
valueAtTime(t)



Dan



Return to posts index

Alex Weil
Re: multiple linear() expressions in a row
on Jan 20, 2020 at 11:17:28 am

sweet ☺ tried something similar with if/else conditions but didnt know about doing it with t=linear(.... and valueAtTime(t) ☺ this works great! thank you


Return to posts index

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