First, let's create a list of objects. For example, the following ggb script:[br][br][code]L_1 = Sequence(Circle((4 random(), 4 random()), RandomUniform(0.2, 1)), i, 1, 10)[/code][br][br]creates a list of circles with different radius in the region [0,4]x[0,4]. [br][br]If you change the color of the list L_1, then all the objects in that list will have the same color you selected. [br]
If you want to use a different color for each object in the list, you can select one object and then apply the color, but that will be very laborious and time consuming. [br][br]Instead we can use ggb scripting to create different objects and then apply dynamic colors.[br][br]
In order to apply different colors to each object of the same class, we can use the command [b]Execute()[/b]. [br][br]First, we need to create a class of objects with specific labels. That is:[br][br][code]Execute(Sequence("C"+i+"=Circle((4 random(), 4 random()), RandomUniform(0.2, 1))", i, 1, 10))[/code][br][br]The script above plots the same number of circles with different radius in the same region as before.
Now, we can use the command [b]SetDynamicColor() [/b]to apply different colors to each object (circles, in this case). That is:[br][br][code]Execute(Sequence("SetDynamicColor(C"+i+", random(), random(), random(), 0.5)", i, 1, 10))[/code][br][br]This script assigns random colors to each one of the objects defined previously and also assigns the value 0.5 to the opacity.[br][br]
Now try to make your own version. Modify the previous ggb scripting lines to explore different options for coloring objects of the same class.[br][br]In case you are not familiar with the Scripting commands used here, you can review them by clicking in the following links:[br][list][*][url=https://wiki.geogebra.org/en/Execute%20Command]Execute()[/url][br][/*][*][url=https://wiki.geogebra.org/en/SetDynamicColor%20Command]SetDynamicColor()[/url][br][/*][/list][br]Here is my final version after adjusting some values:
Also check:[br][br]https://mathed.miamioh.edu/index.php/ggbj/article/view/181
That's it! I hope you found this useful. If so, send me a tweet:[br][br][url=https://twitter.com/jcponcemath]@jcponcemath[/url]