YesNoOk
avatar

Ending Animation Scroll timing (Read 18473 times)

Started by Odb718, October 06, 2021, 02:22:02 pm
Share this topic:
Ending Animation Scroll timing
#1  October 06, 2021, 02:22:02 pm
  • *****
  • Shame on you!
    • USA
Right now this is a place holder. I'm teaching myself some math and I figured it'd be good to post in case someone else is trying something similar.

I have an animation I'd like to scroll right on, and then slow to a stop. It's a very long image and it needs to stop scrolling around 2500 tics.
Because each time I want to slow down the scroll I have to have an additional animation with a different velocity, there's some math I gotta do.

These 4 positions and velocities line up perfectly. Starting with the base image that isn't moving.
Each animation is 150 tics.
Code:
start = 0, 120 
Velocity = 0,0
 
start = 60, 120
Velocity = -0.4,0

start = 0, 120
Velocity = -0.2,0

start = -45, 120
Velocity = -0.1,0
Because we have 150 tics and we want a movement of -0.4, we do 150*0.4 and get 60.
150 tics after that is the 2nd part, so a total of 300 tics will have gone by. 300*0.2 and we get 60.
150 tics after that, 450 tics has elapsed. 450*0.1 produces 45.

so the original position is 0, then we have to move to the right so we add 60. we move an additional 60 bringing us back to 0, and then the last 45 brings us to -45.


If we change up the timing to 150, 1500, 50, and use the same velocities
We'd do 150*.04, 1650*0.2, and 1700*0.1
Making 60 - 330 - 170. Giving us
Code:
[GroundPause]
type  = anim
actionno = 12
start = 0, 120
mask = 1
Velocity = 0,0
[Begin Action 12] ;Ground
503,0,0,0,150
-1,0,0,0,-1

;/////////////////////////////////////////////////////////////// Phase 3 - Scroll Right
[GroundScrollRight]
type  = anim
actionno = 15
start = 60, 120
mask = 1
Velocity = -0.4,0
[Begin Action 15] ;Ground Scroll Right
-1,0,0,0,150
503,0,0,0,1500
-1,0,0,0,-1


;/////////////////////////////////////////////////////////////// Phase 3 - Scroll Right
[GroundScrollRight2]
type  = anim
actionno = 16
start = -270, 120
mask = 1
Velocity = -0.2,0
[Begin Action 16] ;Ground Scroll Right
-1,0,0,0,1650
503,0,0,0,50
-1,0,0,0,-1


;/////////////////////////////////////////////////////////////// Phase 3 - Scroll Right
[GroundScrollRight]
type  = anim
actionno = 17
start = -440, 120
mask = 1
Velocity = -0.1,0
[Begin Action 17] ;Ground Scroll Right
-1,0,0,0,1700
503,0,0,0,-1

So if you just want to start scrolling your image, you just have to do
Tics*Velocity
to get the starting position.
To get a 2nd speed you'd have to line up to the last frame of the scrolling image at your current speed so you'd do
"Postition2" - (Total tics*Velocity)
You can keep stacking speeds to get a smooth slow down.
vVv N00bSaibot & Muramasa RoofTop vVv
Last Edit: October 06, 2021, 02:36:41 pm by Odb718