Concerning changing bolean value

Christian Raasteen shared this question 3 months ago
Answered

I have a parametric function and I have a slider. I use this with animation in the slider, meaning that geogebra runs the alle the different values on the slider. I would like to hide the function as the number on the slider goes to a specific value like 12. How do I that with Javascript or Geogebrascript. I have tried to look around but I cannot see how to do it. I am relatively experienced with other programming languages.

What I have tried is:

In globaljavascript:

function ggbOnInit() {


if (s == 12.56) {


l=true


}


}

l is the bolean variable I want to condition for the objects visibility

Thanks in advance. The file I am working can be seen down below.

Comments (1)

photo
1

Hello,

You use the "trace" of point A to display the curve, but a trace is not a "real" GeoGebra object.

So, using the boolean l to display or not the point A will have no effect on the trace of the point A.

To delete the trace you have to refresh the display by using keys Ctrl+F or command ZoomIn(1) in a script (no zoom, but this command also refreshes the display)

You can for example enter in the GeoGebra script of s : If(s==12,ZoomIn(1))

Regards,

Pierre

© 2019 International GeoGebra Institute