# Applying constant acceleration frame by frame

1. Jun 14, 2009

### CBridgman

1. The problem statement, all variables and given/known data

Hi, I am working on a camera system in flash, and am trying to implement an ease in/out effect where the camera moves between two points, with positive acceleration up to the midpoint, and then negative accelaration up to the end point.

I've had a look through the equations of motion article on wikipedia, and understand how to use the various formulas, but my understanding of how to apply acceleration is not matching what the formulas tell me, and I need to understand why in order to apply the acceleration per frame.

2. Relevant equations

Consider the following:

Given
u (initial velocity) = 0
v (end velocity) = ?
a (acceleration) = 2
t (time interval) = 5
s (distance) = ?

Calculate end velocity
v = u + at (where: v = ?, u = 0, a = 2, t = 5)
v = 0 + 2 * 5
v = 10

Calculate distance
s = 1/2(u + v)t
s = 1/2(0 + 10)5
s = 5 * 5
s = 25

Right, so fair enough, except that I don't understand how you can end up moving a distance of 25 (an odd number) if you're adding an even acceleration number (2) to the velocity per frame. I.e:
Frame 1. Velocity = 2, Distance = 2
Frame 2. Velocity = 4, Distance = 6
Frame 3. Velocity = 6, Distance = 12
Frame 4. Velocity = 8, Distance = 20
Frame 5. Velocity = 10, Distance = 30
(Per frame, I go: velocity = velocity + acceleration)

Since the camera is moved in discrete time intervals (for the simplicity's sake, lets say it's running at one frame per second), I must add the acceleration constant to the velocity in the manner shown above, which produces a distance value that doesn't equal what the equations are telling me.

3. The attempt at a solution

Well, after filling a few pages with calculations, I decided I'd try ask here. ;)

Could anyone please tell me where I'm going wrong?

Last edited: Jun 14, 2009
2. Jun 14, 2009

### diazona

The universe doesn't operate in discrete steps For example, in frame 1, you wrote velocity = 2 and distance = 2. Well, in reality, the velocity is indeed 2, but it hasn't been 2 in the entire time between "frame 0" and frame 1. It starts out at 0 and steadily increases up to 2. So the actual distance traveled will be less than 2 - in fact, it will be 1. That's just what you get out of the equation $s = \frac{1}{2}(u + v)t$.

Try using the equation $s = ut + \frac{1}{2}at^2$, it might be more useful for you.

3. Jun 15, 2009

### CBridgman

Ahaa, thanks diazona. (Slaps self for being silly, etc) It's not so much that I thought the universe operates in discrete steps, but that the formulae could be used in discrete steps, and indeed they can, if applied correctly.