0 Favourites

How do I do a breathing sprite brightness effect

  • Hi! what I'm trying to do is a text image changes it brightness to 0 and then when it reach 0% go back again to 100% and again the same thing, to 0% , like a breathing effect. I added to the sprite an instance variable for control the brightness, I saw this in a project sample on construct 3.

    Anyone can help me with this?

    Thank you!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Use Sine behavior, it's very easy. Set it up with the following parameters:

    Movement: Value

    Magnitude: 100

    In your event sheet add the following:

    System -> On Every Tick -> press_start Set Effect "Brightness" parameter 0 to self.Sine.Value[/code:1u9ejkas]
    
    Why are you changing brightness? When I need a similar effect in my game, I usually change Opacity. In this case, you simply set Movement: Opacity in the Sine plugin and that's it, no programming required.
     
    Or if you need more advanced settings (nicer breathing effect), download and install LiteTween behavior, I highly recommend it.
  • Nearly always behaviors can do all the basics.

    Just add a sine behavior to it, set it to value only and use that value for the brightness amount, like this:

    ...and then...

    If you want it to not stay dark for half the cycle just set the Magnitude to 50 instead of 100 and then in the event make it Sprite.Sine.Value+50

    Edit: dop2000 beat me to it, fair and square

  • Thank you both! I didn't know I could use sine behavior to do that, I thought that behaviour was just for movements, I'm still learning

    dop2000 I'm changing the brightness because I don't want the sprite disappear, just want it to go black and the return to it color.

    ydobemos thanks for the tip of add +50 in the event.

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