Code Sketch
Another illusion
By: Soham Dabral
Category: Art
4


0




cleari() clearOutput() setBackground(ColorMaker.hsl(22, 0.44, 0.51)) def nothing(n: Int) = Picture { } def pattern1(size: Double) = Picture { setPenColor(noColor) setFillColor(ColorMaker.hsl(255, 1.00, 0.43)) forward(80) right(180, size) forward(80) } def pattern2(size: Double) = Picture { setPenColor(noColor) setFillColor(white) forward(80) right(180, size) forward(80) } def drawing(n: Int, size: Double): Picture = { if (n == 1) { nothing(0) } else { picStack( pic, trans(0, -size) * rot(10) -> drawing(n - 1, size) ) } } val pic = picStack( scale(0.25) -> pattern1(100), scale(0.25) * trans(0, -120) * rot(6) -> pattern2(100), scale(0.25) * trans(0, -240) * rot(6) -> pattern1(100), ) val pic1 = picStack( scale(0.75) -> drawing(45, 60), trans(50, -5) * scale(0.6) -> drawing(45, 60), trans(100, -10) * scale(0.45) -> drawing(45, 60), trans(135, -15) * scale(0.35) -> drawing(45, 60), trans(170, -20) * scale(0.25) -> drawing(45, 60) ) val pic2 = picStack( pic1, pic1 .withFlippedX .withTranslation(40, 0), pic1 .withTranslation(550, 0) ) val pic3 = picStack( pic2, trans(0, -550) -> pic2, trans(0, 550) -> pic2 ) val pic4 = picStack( pic3, pic1 .withTranslation(-130, -285) .withScaling(0.45), pic1 .withTranslation(-130, 260) .withScaling(0.45), pic1 .withTranslation(415, -285) .withScaling(0.45), pic1 .withTranslation(415, 260) .withScaling(0.45) ) draw(pic4)





Your Comment:





Login to post a comment