Random variable in animation - point on Circle, Clockwise or counter-clockwise direction.
Heine Strømdahl shared this question 2 years ago
I need a very simple random variable, which is continuously updated, in a simple animation of a movement of a point on the circle periphery. This will enable some random movements around the circle periphery - clockwise or counter-clockwise.
First define T=1, let T go between [0,2π]. Then let (cos(T),sin(T)) and start animation. (Play)
Is it possible to introduce a simple random variable U, which can only take on two values -1 and 1 and which is updated every time the animation starts afresh again from T=0 ?
With (cos(U*T),sin(U*T)) this will produce a random movement clockwise or counter-clockwise.
Heine Stromdahl, Copenhagen
Try with something likeand then to update it
There are 2 Problems:
For 1): SetValue(U, RandomBetween(0,1)*2-1) --> principle from M.Borcherds
The speed of a slider must be (about) constant. This means that the position of the slider must occasionally jump to a new position. This means that the slider is very rarely exactly at the position == 0. So the condition T==0 is not true.
Instead of querying for the current value of T, the difference between the current value and the previous value must be tested (current value - previous value < 0)
Comments have been locked on this page!