FORUMS: list search recent posts

hold an expression at it's last value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Roei Tzoref
hold an expression at it's last value
on Dec 5, 2016 at 10:50:47 am

hey all you expression wizards ☺

I wish to figure out how to stop an expression at it's ending value: say I have a rotation of a layer set to time*30 and I want to create a checkbox control to hold it (and continue) every time I click it.

so I have this:
if (effect("Checkbox Control")("Checkbox")==1) time*30 else ?;

what should I put after the else the makes it "stop at current time" so I can toggle this time expression on and off and keep my current position when I freeze it?

thank you

Roei Tzoref
After Effects Artist & Instructor
♫ Ae Blues Tutorials


Return to posts index

Dan Ebberts
Re: hold an expression at it's last value
on Dec 5, 2016 at 5:18:37 pm

Something like this, probably:


chkBx = effect("Checkbox Control")("Checkbox");
n = 0;
if (chkBx.numKeys > 0){
n = chkBx.nearestKey(time).index;
if (chkBx.key(n).time > time) n--;
}
t = 0;
curTime = time;
if (n > 0){
for (i = n; i > 0; i--){
if (chkBx.key(i).value > 0){
t += (curTime - chkBx.key(i).time);
}
curTime = chkBx.key(i).time;
}
if ((curTime > 0) && (chkBx.key(1).value > 0)) t += curTime;
}else{
if (chkBx.value > 0) t = time;
}
t*30



Dan



Return to posts index

Roei Tzoref
Re: hold an expression at it's last value
on Dec 5, 2016 at 8:52:29 pm

Thank you Dan. it works and I will keep it near. I was thinking this could be much simpler so I could tweak it to other manipulations as well - for example wiggle. here I was thinking that instead of my "?" there's only a few letters of codes and that's it. I can't really get my head around this but blindly copy pasting it. guess this was heavy stuff.

Roei Tzoref
After Effects Artist & Instructor
♫ Ae Blues Tutorials


Return to posts index

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