Page 1 of 1

Learning expressions

Posted: December 10th, 2005, 8:24 am
by gtoschi
I am learning how to use expressions. What numbers would the following code return at say time=4 seconds.

life = 1.2; //life of particle

seedRandom(1,true);
delay = random(life);
if(time < delay){
age = 0;
seed = 0;
}else{
age = (time - delay)%life;
seed = Math.floor((time - delay)/life) + 3;
}
[seed,age] :roll:

Posted: December 18th, 2005, 4:04 am
by Paul Tuersley
Well for me, at 4 seconds it returns an array of two values [5, 1.1]. The expression above will only work on a 2 dimensional property such as position or scale.

But I'm not sure what you're really asking. Is there something you want to do, but need help writing the correct expression?

Paul T