0 Favourites

How do I smoothly increase sprite size to original size

  • 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.

  • 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...

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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

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