Here comes the sun - Remastered!
Check it out with music: https://youtube.com/shorts/IJpAYHmVY70?feature=share
Script Setup
O = (0, 6)
c = Circle(O, 5)
speed = 0.1
t = Slider(0, 24 * 2*pi, 0.01, speed, 200)
SetCoords(t, 150, 450)
f1(x) = 1/3*sin(x + t) - 3 + y(O)
f2(x) = 1/3*sin(x + 1/2*t) - 2 + y(O)
f3(x) = 1/3*sin(x + 1/3*t) - 1 + y(O)
f4(x) = 1/3*sin(x + 1/4*t) - 0 + y(O)
Execute(Zip("SetVisibleInView(f"+k+", 1, false)", k, 1...4))
sun = Circle(O, 2)
La = Sequence(k, k, 0, 2 * pi, pi/16)
Lp = Translate(Zip((1; k + t / 24), k, La), Vector((0, 6)))
L = Zip(Ray(O, P), P, Lp)
A1 = Integral(f1, -6, 6, true)
A2 = Integral(f2, -6, 6, true)
A3 = Integral(f3, -6, 6, true)
A4 = Integral(f4, -6, 6, true)
#-- Colors and other stuff -- #
# Define list of colors
L1 = {51, 102, 204}
L2 = {112, 148, 219}
L3 = {173, 194, 235}
L4 = {214, 224, 245}
L5 = {255, 214, 51}
L6 = {255, 179, 179}
L7 = {230, 242, 255}
LC = {L1, L2, L3, L4, L5, L6, L7}
# L1,L2,L3,L4-> Waves
# L5-> Sun
# L6-> Background circle
# L7-> Background sky
SetDynamicColor(A4, LC(1,1)/255, LC(1,2)/255, LC(1,3)/255, 1)
SetDynamicColor(A3, LC(2,1)/255, LC(2,2)/255, LC(2,3)/255, 1)
SetDynamicColor(A2, LC(3,1)/255, LC(3,2)/255, LC(3,3)/255, 1)
SetDynamicColor(A1, LC(4,1)/255, LC(4,2)/255, LC(4,3)/255, 1)
Execute(Zip("ShowLabel(A"+k+", false)", k, 1...4))
Execute(Zip("ShowLabel(f"+k+", false)", k, 1...4))
SetDynamicColor(L, LC(5,1)/255, LC(5,2)/255, LC(5,3)/255, 0)
SetLineThickness(L, 10)
ShowLabel(L, false)
SetDynamicColor(sun, LC(5,1)/255, LC(5,2)/255, LC(5,3)/255, 1)
SetLineThickness(sun, 10)
ShowLabel(sun, false)
#-- Set layers to plot --#
SetLayer(sun, 0)
SetLayer(L, 0)
SetLayer(A4, 2)
SetLayer(A3, 3)
SetLayer(A2, 4)
SetLayer(A1, 5)
SetLayer(c, 10)
# Background -> Select in Style: Inverse filling!!!
SetDynamicColor(c, LC(6,1)/255, LC(6,2)/255, LC(6,3)/255, 1)
ShowLabel(c, false)
SetBackgroundColor(LC(7,1)/255, LC(7,2)/255, LC(7,3)/255)
# Hide auxiliary stuff
SetVisibleInView(O, 1, false)
SetVisibleInView(Lp, 1, false)
SetVisibleInView(t, 1, false)
SetLayer(t, 9)
# Final settings
CenterView(O)
ShowAxes(false)
ShowGrid(false)
StartAnimation(t, true)
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!