Activity › Forums › Adobe After Effects Expressions › Incremental Countdown (not just another countdown question!)
-
Incremental Countdown (not just another countdown question!)
Posted by Lou Borella on January 21, 2008 at 4:00 pmI have a client that wants me to do a countdown from 5000 to 1 in increments of 10!!
Through out the course of the countdown I need to stop on 100 for a bit then continue on to 10 and stop for a few seconds then continue to 1.Expressions are not my thing yet so I’m asking you guys for some help!!
Thanks in advanceLou …
Brian Lee replied 11 years, 11 months ago 4 Members · 12 Replies -
12 Replies
-
Dan Ebberts
January 21, 2008 at 4:34 pmI think I would add a slider to a text layer, keyframe the slider to do the values and hold times you want, then add this expression to the layer’s source text to get the rounding to the nearst 10:
slider = effect(“Slider Control”)(“Slider”);
Math.round(slider/10)*10Dan
-
Lou Borella
January 21, 2008 at 4:56 pmDan,
Before I try your suggestion here is what I have so far.I actually have the countdown working from 5000 to 1 with the stops I need using the numbers plug-in and adding keyframes to the “value” parameter.
Is there an expression I can add to that parameter that will keep the values counting down in increments of 10?Lou
-
Lou Borella
January 21, 2008 at 5:05 pmDan
I also can’t figure out how to get the text layer to countdown from 5000 to 1!!!
I guess I have to add an animator to the Text layer’s “character value” parameter.
Then add an expression that will only use numbers that will countdown from 5000 to 1.
Then add a slider control and pickwhip the slider to the “character value” parameter
Then keyframe the slider with my stop points.does that sound right?
do you have an expression for the initial countdown?Why does my numbers plugin solution seem easier?
I’m lost …
Lou … -
Dan Ebberts
January 21, 2008 at 5:11 pmYou could just add this to your numbers value parameter:
Math.round(value/10)*10
The other appraoch I was suggesting would require you to add a slider control (Effect > Expression Controls > Slider Control) and keyframe the value of that.
Your way requires fewer steps.
Dan
-
Lou Borella
January 21, 2008 at 5:21 pmDan
this works great thanks.
A lot of times when people ask for help with expressions I believe that they just copy and paste the expression that is given to them. I would like to get an idea of what is going on here.
I understand the Math.round part (and now I see where that command is in the arrow pulldown) but I don’t get the math that is happening within the parentheses and after.Can you explain so I don’t have to ask this question on the forums next time I need help
Thanks
Lou …
-
Lou Borella
January 21, 2008 at 5:28 pmI think I figured out the math and now I realize that it is basically the PEMDAS theory of the order of calculations. Parentheses – Exponents – Multiplication – Division – Addition – Subtraction!!! I also removed the Math.round command and the expression still worked.
Is that an actual part of the expression or is it just text that is there to help the user identify what is happening within the expression? I imagine that some of the larger expression can get a bit hairy and that text can be helpful.Lou …
-
Dan Ebberts
January 21, 2008 at 6:01 pmIt shouldn’t work without Math.round().
What’s going on is that you’re dividing your value by ten, rounding that result to an integer and then multiplying by 10 to get the value back in the original range (but now rounded to the nearest 10).
Dan
-
Lou Borella
January 21, 2008 at 6:24 pmDan
you are right that the Math.round needs to be there.
I’m having a problem when the countdown gets to 10 though. It jumps to 0 instead of counting down from 10 to 1. I know that I can split the layer and remove the expression but since I’m trying to get a handle on expressions is there an “if/than” or some other command that I can add to my expression?Thanks,
Lou … -
Dan Ebberts
January 21, 2008 at 6:31 pmOh yeah, forgot about that part. You can do that with Math.max(), like this:
Math.max(Math.round(value/10)*10,1)
Dan
-
Lloyd Alvarez
January 21, 2008 at 10:15 pmI think he wants the value to countdown by 1’s from 10 to 0 not jump from 10 to 1.
This will go in increments of 10 until it reaches 10 then will go in increments of 1 from 10 to 0.
if (value > 10) {r=10} else {r=1}
Math.round(value/r)*r
Reply to this Discussion! Login or Sign Up