How do I make a "fade effect" for objects?!

Get help using Construct 2

Post » Fri Oct 24, 2014 9:18 am

Hi guys,
I would like to make a "Fade Effect" for my players. When pressing a button, is the opacity go from 100 to 50. I need a smooth transition here. How can I implement it? Thanks for help. :)
B
9
S
4
Posts: 103
Reputation: 1,195

Post » Fri Oct 24, 2014 9:47 am

You could put it in a loop.
When button pressed and opacity greater than 50 -1 from opacity and repeat until opacity is = 50.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
71
S
19
G
8
Posts: 640
Reputation: 9,701

Post » Fri Oct 24, 2014 9:57 am

No, it must work with "dt *" or something.
B
9
S
4
Posts: 103
Reputation: 1,195

Post » Fri Oct 24, 2014 10:06 am

If your using an every x seconds (or fraction of a second) condition it already has framerate independence.

https://www.scirra.com/tutorials/67/delta-time-and-framerate-independence
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
71
S
19
G
8
Posts: 640
Reputation: 9,701

Post » Fri Oct 24, 2014 9:39 pm

@wossi
@chrisinfinger

I just did this for some text I was fading in and out

Do this:

Add sine behavior to the player. under sine behavior change to "value only"

make an event:

ON button pressed -> set player opacity to sine.value(50,100)

This should work. I don't have access to my PC and my CAPX but I believe that is the correct way I did it for the sine.value.
B
13
S
5
G
1
Posts: 119
Reputation: 2,292

Post » Fri Oct 24, 2014 10:07 pm

robertjs3 wrote:@wossi
@chrisinfinger

I just did this for some text I was fading in and out

Do this:

Add sine behavior to the player. under sine behavior change to "value only"

make an event:

ON button pressed -> set player opacity to sine.value(50,100)

This should work. I don't have access to my PC and my CAPX but I believe that is the correct way I did it for the sine.value.


Are you sure you did this? sine.value doesnt take params, it only report its current value. LiteTween will do what the OP wants though.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Oct 24, 2014 10:13 pm

@codah Yea I know I somehow referenced the sine maybe not exactly using that phrase. I need to look when I am home to verify. I didn't use LiteTween or anything.
B
13
S
5
G
1
Posts: 119
Reputation: 2,292

Post » Fri Oct 24, 2014 10:25 pm

robertjs3 wrote:@codah Yea I know I somehow referenced the sine maybe not exactly using that phrase. I need to look when I am home to verify. I didn't use LiteTween or anything.


Good idea though. I guess you set magnitude to 50 then just use sine.value. I'll have to remember this if I can't use 3rd party plugins.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Oct 24, 2014 10:32 pm

You guys are making it way more complicated than it needs to be.

Fade Out Effect
Last edited by Tekniko on Fri Oct 24, 2014 11:00 pm, edited 1 time in total.
B
56
S
15
G
13
Posts: 826
Reputation: 17,705

Post » Fri Oct 24, 2014 10:49 pm

Tekniko wrote:You guys are making it way more complicated than it needs to be.

Fade Out Effect


:D yea I was more commenting on the comments. Not sure if a recursive function is less complicated though :) but good solution, no behaviours or external plugins.

Edit: this also works (he wants to go to 50 opacity)
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 9 guests