SetDynamicColor Script Not Working

legendariersgaming shared this question 1 year ago
Answered

In a slider called "Player" I have the script: If(1<=Player<=1.5, SetDynamicColor(n, 0, 0, 0, Player - 1)) but when updating the slider the opacity of the segment n does not change. I am using the latest version of Geogebra Classic. Also under Dynamic Color settings for n there does not appear to be an opacity option.


EDIT: It appears the reason is because segments do not have an "opacity" option but instead a "line opacity" option which cannot be changed dynamically. I will have to work around this by changing the color of the segment to mimic changing its opacity :/

Comments (5)

photo
1

See attachment

photo
1

Better (without not needed objects)

photo
1

There's a bug in GGB 5.0.518.

Moving the slider generates "<expression" without "<element", which will be supplemented to objects the next time the file is loaded. (For check the Bug you must use a ZIP-Tool to open "geogebra.xml")

photo
1

<element type="numeric" label="c_1">
<value val="0.3333333333333333"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
</element>
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
<expression exp="(a - 1) / 6" />
</construction>
</geogebra>

photo
photo
1

Here some details:

.

A) I open (Colors02_Reopen) with Notepad and clean all generated Object (for example c_1)

B) open the file from A). Move Point A, Not move slider a. Save --> Colors02.1clean

C) check file from B) mit Notepad -> all is OK

D) Open Colors02.1clean. Move slider a. Save --> Colors02_2SliderMove

E) Check with Notpad file from D (Colors02_2SliderMove) --> Not OK, has at last <expression without <element (and no name)

F) Open file from D (Colors02_2SliderMove) -> Now the (wrong) objects are created in Algebra-View (with name)

Move point A, save as Colors02_3Reopen

G) Check with Notepad the file from F) (Colors02_3Reopen)-> Now the wrong objects has a <element (and a name)

-----------------------------------

Guess: with update slider a and his script onUpdate (SetColor()) a bug occurs, but he is not see in the Algebra-View. With Reopen the file the Bug is completed (with <element) and the generated objects appear in the Algebra-View. Maybe the bug is in the Command SetColor().

© 2020 International GeoGebra Institute