Here comes the sun - Remastered!
Check it out with music: https://youtube.com/shorts/IJpAYHmVY70?feature=share
Script Setup
# Define list of colors
n = 1/ 255
C1 = n {51, 102, 204}
C2 = n {112, 148, 219}
C3 = n {173, 194, 235}
C4 = n {214, 224, 245}
C5 = n {255, 214, 51}
C6 = n {255, 179, 179}
C7 = n {230, 242, 255}
# C1,2,3,4-> Waves
# C5-> Sun
# C6-> Background circle
# C7-> Background sky
LC = {C1, C2, C3, C4, C5, C6, C7}
#-- Slider to animate --#
speed = 0.1
t = Slider(0, 24 * 2*pi, 0.01, speed, 200)
SetCoords(t, 150, 450)
#-- Point of reference --#
O = (0, 6)
#-- Circular frame --#
c: (x-x(O))^2+(y-y(O))^2>=5^2
SetDynamicColor(c, LC(6,1), LC(6,2), LC(6,3), 1)
ShowLabel(c, false)
#-- Waves --#
g(x, y, z, w) = y * sin(x + z * t) - w + y(O)/2
LN = 1...4
Execute(Zip("f"+N+"(x) = g(x,1/3, 1/("+N+"), "+N+"-4)", N, LN))
Execute(Zip("SetVisibleInView(f"+N+", 1, false)", N, LN))
Execute(Zip("A"+N+" = Integral(f"+N+", -6, 6, false)", N, LN))
Execute(Zip("ShowLabel(A"+N+", false)", N, LN))
Execute(Zip("SetDynamicColor(A"+N+", LC("+(5-N)+", 1), LC("+(5-N)+", 2), LC("+(5-N)+", 3), 1)", N, LN))
#-- Sun with rays --#
sun = Circle(O, 2)
SetDynamicColor(sun, LC(5,1), LC(5,2), LC(5,3), 1)
SetLineThickness(sun, 10)
ShowLabel(sun, false)
La = Sequence(k, k, 0, 2 * pi, pi/16)
Lp = Zip((1; k + t / 24) + O, k, La)
L = Zip(Ray(O, P), P, Lp)
SetDynamicColor(L, LC(5,1), LC(5,2), LC(5,3), 0)
SetLineThickness(L, 10)
ShowLabel(L, false)
#-- Set layers to plot --#
Lnames = {"sun", "L", "A1", "A2", "A3", "A4", "c", "t"}
Execute(Zip("SetLayer("+name+", "+k+")", k, 0...Length(Lnames), name, Lnames))
# Hide auxiliary stuff
SetVisibleInView(O, 1, false)
SetVisibleInView(Lp, 1, false)
SetVisibleInView(t, 1, false)
# Final settings
SetBackgroundColor(LC(7,1), LC(7,2), LC(7,3))
CenterView(O)
ShowAxes(false)
ShowGrid(false)
StartAnimation(t, true)See the magic! Click the bottom to paint!
Note the colors! :) Have fun!
If you like my work, you can support me in Patreon: https://www.patreon.com/jcponce
There is a digital book with more art here: Mathematical Art in GeoGebra
∞Thanks!