0 Favourites

How do I get a sine wave to stop halfway through?

  • And then re-set it, so the next time it is called it will start from the beginning?

  • From the manual :

    Sine expressions

    CyclePosition

    Return a value from 0 to 1 representing the progress through the current cycle. For example, exactly half way through a cycle this returns 0.5.

    You can use that expression when you're calling it and play around with it at 0.5

  • Two way to do that, one is as alvarop mentionned, use expressions to get the current CyclePosition and do some action when it reaches >= 0.5

    [attachment=1:311ilq29][/attachment:311ilq29]

    The other method, is to use Sine with "value only" and use abs() for a one sided cycle.

    [attachment=0:311ilq29][/attachment:311ilq29]

    First method is easiest, but second method has the best precision (i.e. the Sine value is truly one sided)

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Thanks. I was using Value in a similar way to cyclePosition but had a problem in not being able to reset before I made the sine active again.

    What i am trying to do is when an object reaches a certain point I want it to activate sine to make it look like it has wobbled on stopping, then stop the sine (ideally after a certain amount of times, but halfway through the cycle is fine, if that's the only way)

    What I then want to do is to re start the sine as if it is the first time I have called it, but at the moment its keeping its values so I can't get it to act the way I would like.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)