ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Re: Countdown Timer As Words Instead of Numbers

FAQ   •   VIEW ALL   •   ADD A NEW POST Re: Countdown Timer As Words Instead of Numberson Apr 4, 2015 at 1:13:40 am

You'll have to do some kind of look. You didn't specify the source of your numbers and what you want to countdown (limits etc), so the example I have given below makes some assumptions.

Add this expression to a text source object and add a slider to the text layer. The slider in this case is the source of numbers. So in your question, if the slider is set to 5.59, the text source will read "five fifty nine". The way it's written below will allow for up to 99.99 (which would read "ninety nine ninety nine"). Also note that 1.05 will read "one zero five"

Hopefully there is enough below to give you a starting point.

``` nums = ['zero','one','two','three','four','five','six','seven','eight','nine']; teens = ['ten','eleven','twelve','thriteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']; tens = ['null','null','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety']; function numberToText(number) { numStr="Err" if (number < 10) { numStr = nums[number]; } else if (number <20) { number-=10; numStr = teens[number]; } else { tensIndex = parseInt(number/10); numsIndex= number % 10; if (numsIndex == 0) { numStr = tens[tensIndex] ; } else { numStr = tens[tensIndex] + " " + nums[numsIndex]; } } return numStr; } rawnumber= effect("Slider Control")("Slider"); num1 = parseInt(effect("Slider Control")("Slider")); num2 = ''; num3 = parseInt((rawnumber-num1) * 100); if (num3 < 10) { num2="zero "; } numberToText(num1) + " " + num2 + numberToText(num3) ```

Declan Smith