# How do I come up with a function that can limit/scale the number of steps between a range?

Sorry if the title of this post is difficult to understand...

Basically I am trying to animate something on an X axis based off a "tempo"... The possible valid X coordinates are between -30 and +30, so my range is really 0-60.

I am looking for a way to skip steps of the 0-60, based off of the value of the tempo.

For example, if T=1 (a ridiculously slow tempo), then I would expect to be moving my animation on a per pixel basis, so my X would increment 0,1,2,3,4,5..60...

But if T is something higher, then it would end up skipping steps so that it could arrive at 60 faster... In other words, if T was a really large number, the steps might be something like 0, 15, 30, 45, 60.. or even larger.. maybe ever just 0, 30, 60...

I know what the end goal is of what I want, I just am not sure what out of the old math toolbox to use to get where I want to go with this. If anyone can walk me through the process of how one would figure a way to arrive at the goal, that would great-- because I am drawing a blank on this one.

-
What is the range for T and how is it chosen (steps of 1 of steps varying between some range or something else)? Knowing that, we can probably come up with an adaptive step size based on the X_incr range of {0 ... 60}. –  Amzoti Sep 20 '12 at 5:16
T could be anything... 0-infinity.. But we're talking musical tempos, so realistically it's probably going to be something like 30 to 240... –  patrick Sep 20 '12 at 6:19

Well there must be a time variable. Lets call that $t$. We have $T$ is the tempo. As $t$ increases, or in other words, as time goes on, we want the $x$ position (on the $x$ axis) to increase proportionally. A simple way to put this would be $$x=Tt$$ As $t$ increases $x$ increases as well except in steps of $T$. For example, if $T=5$ then at $t=0$ (no time elapsed), $x$ will be zero (the object hasn't moved). At $t=1$, $x=5$ the object has moved forward by $5$ which is expected because of the tempo $T$ being set at $5$.
Another way to interpret this formula is to see that by multiplying $t$ by $T$ we have $t$ lots of $T$. How much time has passed determines how many lots of $T$, $x$ has moved.