How do I scale an object smoothly with lerp?

0 favourites
  • 4 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hey there,

    i've been trying to make an object appear (spawned from another object) and then do some work on it. It has to "drop from the sky" onto the background. I want to create this effect by using fade in & a set scale function. This is what i have:

    onClick (on a button) => road2 => set scale to lerp(0.1608, 0.0804, 2*dt) .

    Any ideas why it doesn't do anything? Right before this action i do a change angle and fade, and they both work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'd say it's because the onClick event only triggers once - so it starts scaling the object but never gets past the first tick. You probably need a variable set up and when that variable is true run those scaling events and it should work.

  • That's part of the answer. The other issue is even if you used that expression every tick it would be the same. You need a variable that you change over time and use that for the lerp. This could work:

    global number go=0

    global number t=0

    on click

    --- set go to 1

    go = 1

    t < 1

    --- add dt to t

    --- road2: set scale to lerp(0.1608, 0.0804, t)

  • That's part of the answer. The other issue is even if you used that expression every tick it would be the same. You need a variable that you change over time and use that for the lerp. This could work:

    global number go=0

    global number t=0

    on click

    --- set go to 1

    go = 1

    t < 1

    --- add dt to t

    --- road2: set scale to lerp(0.1608, 0.0804, t)

    Great, thanks for the answer, when i get to it i'll give it a try

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