How do I smoothly increase sprite size to original size

Get help using Construct 2

Post » Sat Jul 02, 2016 1:55 am

I have the sprite starting at 0, 0 and would like to smoothly increase its size to 1.

Right now i have:

system > start of layout: sprite > set size to (0, 0)
logo > start fade
logo > enable effect "warp radial"

system > every tick: logo > set size to (self.width + 16 * 0.5, selfheight + 9 * 0.5)

I've tried many different things but the sprite either... doesn't stop growing or it snaps to the 1,1 size, which looks bad.

So how can i smoothly grow the sprite and have it stop at its original size?


Any help is greatly appreciated.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Sat Jul 02, 2016 2:53 am

@jeffige

either you have to test if it has reached 100% in the every tick event (before you change the size)

system > every tick: logo > set size to (self.width + 16 * 0.5, selfheight + 9 * 0.5)

would become:

system > every tick: logo.width less than (target width) > logo: set size to (self.width + 16 * 0.5, selfheight + 9 * 0.5)

or you could use LiteTween: https://www.scirra.com/forum/behavior-litetween_t70700

the nice thing about litetween is that it has many different ease in and out effects. you can also tween different properties at the same time: size, position, opacity, etc...
B
99
S
35
G
20
Posts: 438
Reputation: 17,910

Post » Sat Jul 02, 2016 3:02 am

You can also use LERP.

set width
--- lerp(object.width,object.desiredwidth,1-0.3^dt)
set height
--- lerp(object.height,object.desiredheight,1-0.3^dt)

(Change the 0.3 for different speeds. The lower the number when using ^dt means the faster it will change. This number must be greater than 0 but lower than 1)

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499


Return to How do I....?

Who is online

Users browsing this forum: Elliott, jojomickymack, Palnix777, Yahoo [Bot] and 26 guests