Smoothly expanding sprite

0 favourites
  • 5 posts
From the Asset Store
Pixel Sprites ala ReactorCore - Builder Hardware - Large pack of sprites!
  • How would you do this? I don't mind how it's implemented as log as it looks good (although bonus points for using standard C2).

    Need (on user action):

    • a round (disc) sprite expands from 'zero' to say, 130px radius
    • must be visually smooth
    • must be quick (e.g. no more than 0.3 sec) to fully expand
    • must be same speed on any device (this is for mobile)

    Thanks!

  • You can use lerp()

    [attachment=0:cpmjdla1][/attachment:cpmjdla1]

  • Thanks for that.. It's smoother than what I had and more consistent. I measure 0.22sec on pc (for comparison) and about 0.28sec on my slowest device.

    I added dt to get it the same across devices, and a timer to check. edit: and x4 sprites because I need 4 at once.

    [attachment=0:arlyby38][/attachment:arlyby38]

    I had been playing with scale and even animation frames. Scale is jumpy and animation frames play back at different speeds on different devices.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can set it up a bit different so it will take exactly 0.3 seconds to transition. Then you also could use qarp() or cubic() for a non-linear transition.

    Here are some ideas:

    ease in:

    qarp(0, 130,130, self.t)

    ease out:

    qarp(0, 0,130, self.t)

    Overshoot and fall back:

    qarp(0, 200,130, self.t)

  • Thanks so much, I'd never think to use that. Will be checking it out asap.

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