How to script stop animation when two points or two numbers/distances are equal?
Math123 shared this question 3 years ago
I want to stop animation when two number one is fixed on x-axis at some number x(A) = a ,and other point x(B) = b is moving with slider t toward a . I want to stop animation when a=b and it start where t has start value, and reset tracer ( I used this script for tracer reset ZoomIn) .
Pls see attached.
Files: animation stop.ggb
- Feedback & Questions
- +43 677 6137 2693
You need a complete, consistent and precise, verbal description of how the 3 points are defined (if necessary with sliders and their definitions).
Without this definitions I (nobody) can't support you.
You should set the step for t=0.01, since you are using 2 decimals in the General settings, then use a trick on the speed of t.
In the Slider tab of the Properties window of t, enter
If(a - 0.02 ≤ t ≤ a + 0.02, 0, 2)
in the Speed box.
But then the labels on your button won't be always correct, becuse the animation can stop also regardless of the status of the button. You should rewrite them accordingly.
Alternative without scripts
Attached 2 possibilities with sliders.
When you need only 1 slider: Please define what he do with my points A,B,C. For example: A is placed manual, B has the same y-value as A and the distance to A is given by a slider (--> noScripts03).
Comments have been locked on this page!