0 Favourites

# Pulsating transparency

This forum is currently in read-only mode.
• 6 posts
• Has anyone done a visual effect where an object might slowly have its transparency reduced to zero, then back up to 100%? If so, are there any nice effective ways of going about this? So far, the only thing I can think of is using a variable to determine when to raise or lower the transparency. If transparency = 100, set variable to 1. If variable = 1, reduce transparency every tick. If transparency = 0, set variable to 0. If variable = 0, increase transparency every tick.

Would something like that be my only method of executing an effect like this?

• You can use Sine behavior to do it easly without any event.

Events hmm:

+ System: Is global variable 'opct' Equal to 0
-> Sprite: Set opacity to Sprite.Opacity-100*TimeDelta
+ System: Is global variable 'opct' Equal to 1
-> Sprite: Set opacity to Sprite.Opacity+100*TimeDelta
+ Sprite: Opacity Equal to 0
-> System: Add 1 to global variable 'opct'
+ Sprite: Opacity Equal to 100
-> System: Set global variable 'opct' to 0

or

+ System: Always (every tick)
-> System: Add 1 to global variable 'opct'
-> Sprite: Set opacity to Sprite.Opacity-sin(global('opct'))

• ## Buy Construct 3

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

Construct 3 users don't see these ads
• You can simplify those by using the timer, a built in variable. Other options, you could also use lerp:

always

• set opacity to lerp(0, 100, timer/300)

or use

always

• set opacity to cosp(0, 100, timer/300)

...for a sine wave instead. But yeah, the sine behavior is the easiest.

• You can use Sine behavior to do it easly without any event.

I didn't even know you could do that. Must be a new addition to sine. Neat.

• You can simplify those by using the timer, a built in variable. Other options, you could also use lerp:

always

- set opacity to lerp(0, 100, timer/300)

or use

always

- set opacity to cosp(0, 100, timer/300)

i don't think construct will ever stop suprising me. Thank you so much for this Arima!

• I hear ya. I've been using it since the earliest betas and I'm STILL occasionally surprised by features I didn't know about! XD

BTW Kisai, I think you're right, I recall extra options being added to it a while ago.

• 6 posts