Suggestion - Reversed Fade Behaviour

Discussion and feedback on Construct 2

Post » Wed Sep 11, 2013 3:23 pm

Not complicated but useful, instead of using 2 different fade behaviours, why not make the fade behaviour reversible?

Fadeout-Wait-Fadein.
Image
B
71
S
28
G
12
Posts: 515
Reputation: 12,284

Post » Wed Sep 11, 2013 3:43 pm

You can achieve this result using the EaseTween or LiteTween behaviors, made by lunarray http://www.scirra.com/forum/behavior-litetween_topic53288_page1.html
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Wed Sep 11, 2013 5:51 pm

Great, thanks!
Image
B
71
S
28
G
12
Posts: 515
Reputation: 12,284

Post » Wed Sep 11, 2013 9:04 pm

You may want to learn to just skip it all together and just do it yourself so you can have more freedom. You can do it a number of ways--one of the easiest being make a private variable on the object you want to fade.

If Object.Variable = 1    ----> set opacity to Object.Opacity+200*dt
and Object.Opacity < 100


(you can change the 200 to whatever you want).

Then to fade out just set the variable to 0 and do:

If Object.Variable = 0    ----> set opacity to Object.Opacity-200*dt
and Object.Opacity > 0


So I do like the two Tween plugins, but for simple fades just do it that way and save yourself the overhead. A single event for either direction takes care of everything.
B
103
S
38
G
19
Posts: 962
Reputation: 17,986

Post » Thu Sep 12, 2013 6:51 pm

+1
B
17
S
4
G
4
Posts: 143
Reputation: 4,004

Post » Thu Sep 12, 2013 7:49 pm

[QUOTE=C-7] You may want to learn to just skip it all together and just do it yourself so you can have more freedom. You can do it a number of ways--one of the easiest being make a private variable on the object you want to fade.

If Object.Variable = 1    ----> set opacity to Object.Opacity+200*dt
and Object.Opacity < 100


(you can change the 200 to whatever you want).

Then to fade out just set the variable to 0 and do:

If Object.Variable = 0    ----> set opacity to Object.Opacity-200*dt
and Object.Opacity > 0


So I do like the two Tween plugins, but for simple fades just do it that way and save yourself the overhead. A single event for either direction takes care of everything.[/QUOTE] Excellent!
* Steals code and runs *
@C-7 is this better than the included Fade behavior??
ghost2013-09-12 19:53:58
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Fri Sep 13, 2013 1:15 pm

[QUOTE=ghost] [QUOTE=C-7] You may want to learn to just skip it all together and just do it yourself so you can have more freedom. You can do it a number of ways--one of the easiest being make a private variable on the object you want to fade.

If Object.Variable = 1    ----> set opacity to Object.Opacity+200*dt
and Object.Opacity < 100


(you can change the 200 to whatever you want).

Then to fade out just set the variable to 0 and do:

If Object.Variable = 0    ----> set opacity to Object.Opacity-200*dt
and Object.Opacity > 0


So I do like the two Tween plugins, but for simple fades just do it that way and save yourself the overhead. A single event for either direction takes care of everything.[/QUOTE] Excellent!
* Steals code and runs *
@C-7 is this better than the included Fade behavior??
[/QUOTE]

No clue, but it's super easy and you can use the same code for pretty much anything and make it framerate independent. Ie use Object.X instead to move. Your next step is to do similar stuff with lerp to make it look even better.
B
103
S
38
G
19
Posts: 962
Reputation: 17,986

Post » Fri Sep 13, 2013 5:13 pm

@C-7 thanks a lot bro,
* feels awesome like superman *
B
12
S
3
G
1
Posts: 347
Reputation: 2,866


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests