Hi all, looking for a math wiz who can show me if it's possible to scale a number up and down using sin or cos.

The idea is to have a 1 line calculation for increasing and decreasing a whole number back and forth, like this:
1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 10 etc.

I can do this with flags, here is the code:
Code:

var numCtr = 1;
function testIncrement()
{
var flagCtr = 1;
while(1)
{
numCtr += flagCtr;
if(numCtr == 10 && flagCtr == 1)
{
flagCtr = -1;
}
if(numCtr == 1 && flagCtr == -1)
{
flagCtr = 1;
}
wait(-1);
}
}on_t testIncrement;



Anyone have a calculation that does this in less code using sin or cos?

Thanks

-raiden


"It doesn't matter if we win or lose, it's how we make the game."
--------------------
Links: 3DGS for Dummies