Harmony 2

Author:
Thijs
In response to Harmony The SetLayer is not necessary if you create in the correct order! - Use Delete button. - Change value of n. - Recreate with Setup. Setup Script: #------------------------ # Auxiliary stuff #------------------------ Execute(Zip("Delete[A"+k+"]", k, 1...99)) Execute(Zip("Delete[B"+k+"]", k, 1...99)) n = Slider(15, 45, 2, 1, 180, false, true, false, false) O = (0, 0) speed = 3 t = Slider(0, 2pi, 0.01, speed, 180, false, true, false, false) f(x) = pi/10 * cos(x) blc = "Black" wt = "White" #------------------------ # Rectangles #------------------------ p = Polygon({(-1, -2),(1, -2),(1, 5),(-1, 5)}) Execute(Zip("A"+k+" = Rotate( p, f(t+"+k/n*2pi+"), O )", k, 1..n)) Execute(Zip("If(Mod("+k+",2)==0, SetColor(A"+k+", wt), SetColor(A"+k+", blc))", k, 1..n)) Execute(Zip("SetFilling(A"+k+", 1)", k, 1..n)) #------------------------ # Circles #------------------------ c = Circle((0, -4), 1) Execute(Zip("B"+k+" = Rotate( c, f(t+"+k/n*2pi+"), O )", k, 1..n)) Execute(Zip("ShowLabel(B"+k+",false)", k, 1...n)) Execute(Zip("If(Mod("+k+",2)==0, SetColor(B"+k+", wt), SetColor(B"+k+", blc))", k, 1..n)) Execute(Zip("SetFilling(B"+k+", 1)", k, 1..n)) #------------------------ # Settings #------------------------ CenterView(O) ShowAxes(false) ShowGrid(false) SetBackgroundColor(wt) Lname={"O","p","c","f","t","blc","wt"} Execute(Zip("SetVisibleInView("+name+", 1, false)", name,Lname)) Delete[Lname] StartAnimation(t, true)