How to script stop animation when two points or two numbers/distances are equal?

Hayat shared this question 7 months ago
Answered

Hello Team,

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[1]) .

Pls see attached.

Best Answer
photo

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.

Comments (11)

photo
1

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.

photo
1

Thanks @Simona Riva , it worked. But i also want to continue my 't' slider back at start value as a=b. it continue back from start 't' and end at a=b also clear tracer, and the cycle continue until i stop.

photo
photo
1

Alternative without scripts

photo
1

Thanks for your reply. It is not working for my project. I used 't' slider for change in position of Point B. Pls give me the solution as per my attachment , it will work for my project. I want exactly what you share in attachment that as A=B slider 't' become its initial position and cycle continues until i stop the animation.

photo
1

I'm sorry, I just want to give you the idea. If you like this idea, it's up to you to implement it in your project.

photo
1

Yes it is good idea . I checked it in my project. But it did not work with slider 't' . If it is possible with slider 't' pls share

photo
photo
1

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).

photo
1

Pls see attached is it possible for me the same you shared as in attached. You used C=Point(f) , but my Point C=(t,0)

where 't' is slider. I want scripting or anything like that as If[A=B,SetValue(t,0)] like that. It does not work here.

photo
1

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.

photo
1

Dear @rami,

thanks for the support. I am tried everything but none of them worked. How can i discuss about this.

photo
1

Thanks Rami,

Your attachment noScript04.ggb helped me . Thank you so much and your team who always respond.

photo
© 2019 International GeoGebra Institute