Spiky flower with music
Note: It takes a few seconds to load the music. It all depends on your connection.
Script
# ------------------------
# GeoGebra scripting
# ------------------------
# ------------------------
# Button 1 Create stuff
# ------------------------
n = Slider(1, 100, 1, 1, 200, false, true, false, false)
SetValue(n, 100)
N = Sequence(1, n)
S = Zip(Polygon((0,0,0), (2cos(k*pi/7),2sin(k*pi/7)), (3cos((k+1)*pi/7),3sin((k+1)*pi/7), k/15)), k, N)
Execute( Sequence("A"+k+"= Element(S, "+k+")", k, 1, Length(S)))
Execute(Sequence("SetDynamicColor(A"+k+", 0.2, "+k+"/Length(S), 0.5)", k, 1, Length(S)))
Execute(Sequence("SetLineThickness(A"+k+", 1)", k, 1, Length(S)))
Execute(Sequence("SetFilling(A"+k+", 1)", k, 1, Length(S)))
t = Slider(0, 2 pi, 0.01, 0.6, 200, false, true, false, false)
# --------------------------------------------------------------
# Add in slider 't' on Update this script:
# SetViewDirection(Vector((1; t; -0.322)), false)
# --------------------------------------------------------------
# ------------------------
# Button 2 Delete stuff
# ------------------------
Execute(Sequence("Delete(A"+k+")", k, 1, Length(S)))
# ------------------------
# Button 3 Music :)
# ------------------------
PlaySound("https://jcponce.github.io/assets/audio/01-Time-In-A-Bottle.mp3")
# ------------------------
# Global JavaScript
# ------------------------
function ggbOnInit() {
ggbApplet.evalCommand("SetValue(n, 1)");
ggbApplet.evalCommand("RunClickScript(button3)");
}
Details about PlaySound command
Credits
Time in a Bottle by Jim Croce
https://en.wikipedia.org/wiki/Time_in_a_Bottle