# Rotate in 2D Graphics without Layers

Author:
Thijs
Topic:
Rotation
I cooked up something that might be interesting. 3D rotation in 2D Graphics without Layers. A little cryptic maybe, but it works. History post: Harmony from Juan Carlos Ponce Campuzano post Rotate in 2D Graphics without Layers Setup Script: α = Slider(0°, 360°, 0.5°, 0.5, 200, true, true, false, false) n = 24 Lk = 1...n Lα = Zip(α + k*360°/n, k,Lk) #============================================= # Create Polygons in the correct order #============================================= LP = Zip((cos(α),sin(α)/6), α,Lα) Lpol = Zip(Polygon({P,P+(0,2),2P+(0,2),2P}), P,LP) Ls = Sort(Lk, Zip(-y(P),P,LP)) Lpols= Zip(Element(Lpol,s), s,Ls) Execute(Zip("pols"+k+"=Element(Lpols,"+k+")",k,Lk)) #============================================= # Settings #============================================= SetVisibleInView[α,1,false] SetVisibleInView[LP,1,false] SetVisibleInView[Lpol,1,false] Execute(Zip("SetDynamicColor(pols"+k+",Element(Ls,"+k+")/n,1,1,1)",k,Lk)) CenterView((0,1)) SetBackgroundColor["Black"] StartAnimation[α,True] #============================================= # After Setup: #============================================= # - Slider α: Set repeat: Increasing # - All Polygon: Set Dynamic Colors: HSV # - All Polygon: Set Selection Allowed: off # - Use button Setup a second time #=============================================