[solved] How do I lerp the parallax layer?

1 favourites
  • 2 posts
From the Asset Store
4K Hand Painting, 300 dpi and layer layer, psd and png files. 3200 x 4200
  • I can set the parallax value in % in layer settings. But if viewport jumps suddenly several pixels, the parallax is not smooth.

    I tried lerping the layer manually, but the lerp function is a bit vaguely documented.

    And I also want it to be pixel perfect, so no floats in coordinates (rounding the coordinates to integers in later stage is not optimal and can cause glitches).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So you need to smoothly change the parallax from 0% to 50% for example? You can use lerp, but it needs to run on every tick:

    Every tick: Set layer "foo" parallaxX to lerp(LayerParallaxX("foo"), 50, dt*2)

    It may be easier to use Tween behavior - add it to any object, ran a value tween from 0 to 50. While it's running, set layer parallax to tween value. With tween you will be able to choose different easing functions, which is not possible with lerp.

    I'm not sure what can be done about "pixel perfect".

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