Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions frame by frame on off flicker expression error

  • frame by frame on off flicker expression error

    Posted by Brecht Debackere on December 4, 2007 at 2:01 pm

    Hiya,

    I’m witnessing some weird behavior with a simple expression:
    I have a layer and want to set its opacity to alternate between 0 and 100, the expression I added to the opacity property is :

    [((time*100/4)%2)*100];

    This works for a few seconds, but then all of a sudden the results go haywire…the modulo basically tells me whether the frame is even or odd, but all of a sudden I get nrs. like 1.4210854715202e-14, etc.

    Any tips welcome…

    Dan Ebberts replied 18 years, 5 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    December 4, 2007 at 5:40 pm

    Not sure what your expression does, but will this do what you want?

    (timeToFrames(time)%2)*100

    Dan

  • Brecht Debackere

    December 4, 2007 at 6:12 pm

    Yes. I does exactly what I want 🙂
    My expression took the float of time (0.04, 0.08, 0.12,..)
    multiplied it by 100 to get an int, and divided it by 4 to get an by 1 increasing nr. per frame.
    Basically the same, but still weird that the 110%2 returns 1.42…e-14
    Thanks for the tip.

  • Dan Ebberts

    December 4, 2007 at 9:04 pm

    Ah, OK. The time is stored as a floating point value and there’s nothing in your expression that expressly converts the result to an integer (multiplying by 100 just converts it to a larger floating point value) so what you’re seeing is a small error resulting from not being able to represent fractional values exactly.

    Dan

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