Count down to XMAS

Stats

659 visits, 952 views

Translations

This tutorial hasn't been translated.

Tools

Hi all,

Merry Christmas & Happy New Year to you!

This tutorial will explain how you can count down to a day or an event of your choice.

Step 1: Download Date plugin

rex_rainbow date plugin (http://c2rexplugins.weebly.com/)

Logic : the rex_rainbow date plugin will provide you the Unix style time in millisecond that can be exploited to to make a countdown time for a particular day or event as explained below.

    @Convert number of seconds into hours, minutes and seconds and return an array       containing those values to create count down timer.
    // variables
    timeStamp  = Number of seconds to parse  // this is fteched from dae plugin
    secondsInAMinute = 60
    secondsInAnHour  = 60 * secondsInAMinute
    secondsInADay    = 24 * secondsInAnHour
    // extract days
    days = floor(inputSeconds / secondsInADay)
    // extract hours
    hourSeconds = inputSeconds % secondsInADay
    hours = floor(hourSeconds / secondsInAnHour)
    // extract minutes
    minuteSeconds = hourSeconds % secondsInAnHour
    minutes = floor(minuteSeconds / secondsInAMinute)
    // extract the remaining seconds
    remainingSeconds = minuteSeconds % secondsInAMinute
    seconds = ceil(remainingSeconds)

Step 2: declare following variables for conversion.

Step 3: write a function to convert the fetched seconds into days, hours, minutes and seconds.

Step 4: call this function every second for real time update.

That it, hope might be useful in some way.

Demo and CAPX here.

Download

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!