Simple Animation

  • Is there a way to create a simple animation in C2 without using the actual sprite animation?

    I just want to make a logo slide from a Y Value to another Y Value.

  • Global number t = 0  //evolution of interpolation (from 0 to 1)
    Global number startY = -20 //vertical start position of movement
    Global number enY = 300    //vertical end position of movement
    Global number speed = 100  //average speed in px per second
    System:Every tick
      -> System: set t to min(t+dt*speed/Abs(endY-startY),1)[/code:11ceqqut]
    And then
    For a linear movement you use
    [code:11ceqqut]System: Every tick
      -> Sprite: set Y to lerp(startY,endY,t)[/code:11ceqqut]
    For an eased-out movement you use
    [code:11ceqqut]System: Every tick
      -> Sprite: set Y to lerp(startY,endY,t^2)[/code:11ceqqut]
    For an eased-in movement you use
    [code:11ceqqut]System: Every tick
      -> Sprite: set Y to lerp(startY,endY,t^0.5)[/code:11ceqqut]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thank you <img src="smileys/smiley1.gif" border="0" align="middle" />

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