Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Mark Saliba on August 17, 2009 at 11:21 am

    Hi i’m kind of new to this whole expressions thing. So i obtained a code to use as a counter. Meaning like to count from 1 to 25 for example.

    Well this is what i did. I had the text layer and selected the source text and added an expression from the animation menu. But when i inserted the code and modified the numbers and tried to run it i got an error. It said there’s a missing bracket “)” in line 6.

    This is the code:

    var targetValue = 32; // final desired value
    var startShift = 25; // frames to skip before starting
    var display = 0; // starting value to display

    var internalTime = timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false);
    if (internalTime – startShift > targetValue) {
    display = targetValue;
    } else if (internalTime – startShift < 0) {
    display = 0;
    } else {
    display = internalTime – startShift;
    }
    display;

    Please help me sort out the problem and sorry for my ignorance in expressions.

    Mark Saliba replied 16 years, 11 months ago 3 Members · 5 Replies
  • 5 Replies
  • Rob Dahl

    August 17, 2009 at 12:54 pm

    I created a new comp with 1000 frames using CS3 and CS4.
    Created a text layer.
    Selected the text, and added
    Animations Preset/Text/Expressions/Frame Number.
    Opended in the timeline the text and selected:
    Text/Source Text and held the alt-key and clicked the stopwatch to get the expression line. Replaced the existing code with yours.

    Ram tested the code…
    From frame 0 to 25 the display showed 0, then at 26, 1 was displayed all the way to 32. Then the remainder of the frame still only displayed 32.

    I could chaged vartargetValue=32; to 0 or 1000. all numerals worked including -1.

    I cannot get a syntax error. What version do you have?

    Rob Dahl
    Transparent Alchemy
    Boulder City, NV 89005
    http://www.transparentalchemy.com

  • Mark Saliba

    August 17, 2009 at 1:35 pm

    i’m running cs4 9.0. tried it your way but still getting the same error.. =/

  • Dan Ebberts

    August 17, 2009 at 3:12 pm

    I don’t get a syntax error. Is the code you pasted that code that’s generating the error, or have you modified it in some way?

    Dan

  • Rob Dahl

    August 17, 2009 at 5:31 pm

    Here is one of my that works.
    See if it does on your system.
    https://www.transparentalchemy.com/CounterExample.aep

    Rob

    Rob Dahl
    Transparent Alchemy
    Boulder City, NV 89005
    http://www.transparentalchemy.com

  • Mark Saliba

    August 17, 2009 at 6:35 pm

    Rob, thanks for your help… i copied the code from the project you gave me and it worked. I still have to sort out what was the problem but at least i got it working thanks to you. Thanks once again. I appreciate.

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