Forum Replies Created

  • Nathaniel Schweinberg

    April 28, 2010 at 5:04 pm in reply to: Full-featured countdown timer

    One thing I noticed is that even though there is an if statement at the end saying if there is less than 10 seconds left tack on a 0 in front of the digit, it still didn’t. I adapted the script to fit for countdowns under 60 seconds =]

    //Full Function Countdown Script
    //Written by Jason Vore - codered10@hotmail.com
    //Edited by Nathaniel Schweinberg - nathaniel@ftcmedia.com

    //Attach as an expression for the source text for a Text Layer.

    intMinutesToCountdown = 0; //How many minutes you want to be counted down.
    intSecondsToCountdown = 30; //How many additional seconds you want to be counted down.

    offset = 2; //Number of seconds to hold the countdown timer at full before it starts counting down

    boolIncludeMinutes = 0; //1 to include minutes, 0 to exclude
    boolIncludeDecimalSeconds = 0; //1 to include decimal parts of seconds, 0 to exclue
    intDecimalsToInclude = 0; //Number of decimal points to include
    boolAllowNegativeTimes = 0; //1 to allow the countdown to run past 0, 0 to hold the timer at 0 seconds.
    boolIncludeLeadingZeroes = 1; //1 to include leading zeroes in front of minutes to keep text in same location

    //DO NOT EDIT ANYTHING BELOW THIS LINE!

    i = inPoint + offset; //the "time" to actually start the countdown

    intSecondsToCountdown = intMinutesToCountdown * 60+ intSecondsToCountdown; //calculates total seconds in the countdown
    fltSecondsRemaining = intSecondsToCountdown - time + i; //decimal of number of seconds remaining, uses i start the countdown at the inpoint of the clip

    if (fltSecondsRemaining > intSecondsToCountdown)
    {
    fltSecondsRemaining = intSecondsToCountdown; //If we haven't gotten out of the offset period, reset the timer to full.
    }

    if(!boolAllowNegativeTimes)
    {
    if(fltSecondsRemaining<0) fltSecondsRemaining = 0; //If we've passed zero seconds and user has chosen not to allow negative times, reset time to 0.
    }

    intMinutesRemaining = Math.floor(fltSecondsRemaining/60); //Calculates number of minutes remaining

    decSecondsRemaining = fltSecondsRemaining - 60 * intMinutesRemaining; //reduces seconds to less than 60

    intDecimalMultiple = Math.pow(10,intDecimalsToInclude); //Multiplier for placing decimal place in the correct spot.
    decSecondsRemaining = Math.floor(decSecondsRemaining * intDecimalMultiple); // moves decimal to the right and chops remainder
    dspSecondsRemaining = decSecondsRemaining/intDecimalMultiple; //prepare the seconds for display - puts the decimal point back where it belongs

    if (!(decSecondsRemaining%intDecimalMultiple) && boolIncludeDecimalSeconds)
    {
    dspSecondsRemaining = dspSecondsRemaining + "."; //If we are at an even second and the user wants the decimal places displayed, tag the decimal point on to the string.
    }

    if(boolIncludeDecimalSeconds)
    {
    for (a=1;a<=intDecimalsToInclude;a++)
    {
    if(!(decSecondsRemaining%Math.pow(10,a)))
    {
    dspSecondsRemaining = dspSecondsRemaining+"0"; //Add appropriate trailing zeroes if we are showing decimals.

    }
    }
    }

    if(decSecondsRemaining < 10) //EDIT-Removed the boolean statement requiring boolIncludeMinutes
    {
    dspSecondsRemaining = '0' + dspSecondsRemaining; //if we are under 10 seconds and displaying minutes, and a leading 0 to the seconds
    }

    if(boolIncludeMinutes && intMinutesToCountdown >= 10 && intMinutesRemaining<10 && boolIncludeLeadingZeroes)
    {
    dspMinutesRemaining = '0' + intMinutesRemaining;
    }
    else
    {
    dspMinutesRemaining = intMinutesRemaining;
    }

    ':' + dspSecondsRemaining

  • Nathaniel Schweinberg

    April 28, 2010 at 4:41 pm in reply to: Full-featured countdown timer

    This is great, thanks so much!

  • Nathaniel Schweinberg

    November 6, 2009 at 1:10 am in reply to: delayed decay

    so I’m using a similar expression that’s shown below…

    but for some reason it jumps down before it goes up and it looks unnatural. any ideas why its working like this?

    if (time > 1) {
    veloc=15;
    amplitude=75;
    decay=effect("Decay")("Slider");
    y=amplitude*Math.sin(veloc*time)/Math.exp(decay*time);
    position+[0,y]
    }
    else{value}

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy