Smooth layout scale?

0 favourites
  • 10 posts
  • Hi all

    Is there a way to make Smooth layout scale?

    Example:

    On start of layout........Set layout scale to 1

    player on collision with object.....Set layout scale to 0,8

    If i use this event it's not smooth.

    Any one can help please?

    Best Regards

  • Sorry

    But any one can help

  • variable scaler = 1

    every tick

    system set layer scale "Background"

    lerp(LayerScale("Background"), scaler, 0.01)

    would you change the variable scaler at any one time to 2, it would gradually smooth the scale of the layer called "Background" to 2.

  • Thanks alot

    But i want to change all the layout scale not layer

    If i set the layout to 1 and then when player on collision with object .... set layout scale to 0.8 ... it work find but not smoothly.

  • oi, ....

    scaler = 0.8

    every tick

    set layoutscale lerp(1,scaler,0.1)

  • Sorry i'm confuse

    What the difference between your code and:

    Player on collision with A.......Set layout scale to 0.8

    And how can this help to get smooth zoom out?

  • He is telling you don't set the scale on collision. On collision set a variable and then when that variable matches whatever you get it to, set layoutscale to lerp(layoutscale, 0.8, 3*dt) to have it smoothly move between the current layout scale and 0.8 scale.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • slanw, `lerp()` is a system expression that allows you to smoothly change from one value to another. If you read the definition for it, then at first it may sound a little complicated, but basically, it allows for exactly what you are looking for.

    From the Manual:

    "lerp(a, b, x) Linear interpolation of a to b by x. Calculates a + x * (b - a)."

  • Thank's alot all for the help

    And yann capx is awesome

    This is nice example for smooth zoom in and out

    Best regards to all

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