How to clean the 3D graphics created with trace mode?

jospercomp shared this question 8 months ago
Answered

How to clean the 3D graphics created with stroke mode when a slider reaches its maximum or minimum value.

I tried this command script. But it is not working.

If(hmax == 5, Execute ("SetActiveView (-1)", "ZoomIn [1]", "UpdateConstruction [2]"))

Best Answer
photo

The Problem is:

To query in a script for a slider to "equal" (==) with the actual slider value the available time is (usually) too short.


Solution 1 (not works for all situations [can be executed more the 1 time, etc])

If(<slider> >= <max>-10^-3 || <slider> <= <min> + 10^-3, <only one true command>, <only one false command>)


  • Note: only one commande: because if the condition change all following commands work whith the changed condition (that mean: mostly not works, because the slider value has changed and so the condition can be not true)


Solution 2

The slider is stopped at maximum or minimum. "Increasing once" is used for this. Now the script has any amount of time. The animation is started again at the end of the script.

To be able to use "decreasing once" the sign of the speed is reversed. A negative sign of speed moves the slider backwards and stops at the minimum The speed of the slider must be defined as object and referenced in speed of the slider.

Attached one example with oscillating slider movement and script at the 2 ends of slider (GGB5.0 or GGB6.0).

Comments (7)

photo
1

Please post your file :)

Also, avoid adding blank spaces between the command name and its parameters.

e.g. ZoomIn (1) is wrong

ZoomIn(1) is correct

photo
1

If(hmax==5 || hmax==0,Execute("SetActiveView(-1)","ZoomIn(1)","UpdateConstruction(2)"))


Place this script in the slider. I'm not mistaken for the script; But it doesn't clean the 3D view.

photo
1

eb3989e1a65da7b84bad73489d561346

photo
1

Hi

A list is between {}. For example {2,1,3}

So :

If(hmax==5 || hmax==0,Execute({"SetActiveView(-1)","ZoomIn(1)","UpdateConstruction(2)"}))

photo
photo
2

The Problem is:

To query in a script for a slider to "equal" (==) with the actual slider value the available time is (usually) too short.


Solution 1 (not works for all situations [can be executed more the 1 time, etc])

If(<slider> >= <max>-10^-3 || <slider> <= <min> + 10^-3, <only one true command>, <only one false command>)


  • Note: only one commande: because if the condition change all following commands work whith the changed condition (that mean: mostly not works, because the slider value has changed and so the condition can be not true)


Solution 2

The slider is stopped at maximum or minimum. "Increasing once" is used for this. Now the script has any amount of time. The animation is started again at the end of the script.

To be able to use "decreasing once" the sign of the speed is reversed. A negative sign of speed moves the slider backwards and stops at the minimum The speed of the slider must be defined as object and referenced in speed of the slider.

Attached one example with oscillating slider movement and script at the 2 ends of slider (GGB5.0 or GGB6.0).

photo
1

Excellent. Amazing.

photo
1

Which I forgot to mention:

Execute(<script-list>) counts as 1 command.

The condition is not considered within the list (Only the command Execute, but not its contents, takes the condition into account).

But since the slider does not move in solution 2, the condition "If(<slider>== <max>, .....)" does not change and Execute(<script-list>) need not be used in onUpdate of slider (but can be used).

photo
© 2020 International GeoGebra Institute