Code Sketch
MOuntain Reflection
By: Aditya Pant
Category: Art
size(780, 660) cleari() zoom(1.005) setBackground(black) //Background val bgColor = cm.linearGradient(0, 0, Color(44, 185, 255), 0, cheight, ColorMaker.hsl(0, 0.40, 0.50), false) val bg = fillColor(bgColor) * penColor(noColor) * trans(0, cheight / 2) -> Picture.rectangle(cwidth, cheight / 2) //Mountains val mountain = Picture.fromVertexShape { s => import s._ beginShape() curveVertex(0, 0) curveVertex(0, 0) curveVertex(50, 50) curveVertex(70, 45) curveVertex(100, 0) curveVertex(150, 50) endShape() } val mColor = cm.linearGradient(0, 0, ColorMaker.hsl(35, 0.76, 0.05), 100, 50, cm.hsl(35, 0.75, 0.30), false) def mountains(n: Int): Picture = { val mtn = if (randomBoolean) mountain else mountain.withFlippedX.withTranslation(-100, 0) if (n == 1) { penColor(brown) * fillColor(mColor) -> mtn } else { picStack( penColor(brown) * fillColor(mColor) -> mtn, trans(85, 0) -> mountains(n - 1) ) } } //Mountains //Moon val moon = penColor(noColor) * fillColor(cm.silver) -> Picture { forward(50) right(90) right(90, 50) right(90) forward(50) } //Moon //Birds def bird(s: Double) = penColor(black) -> Picture { right(90) right(60, s) left(120) right(60, s) } def birds(n: Int, s: Double): Picture = { if (n == 1) { bird(s) } else { picStack( bird(s), trans(50, s * 0.6) -> birds(n - 1, s * 0.8) ) } } //Birds //Moonlight val moonLight = distantLight(235, 10) //Moonlight val pic1 = effect(moonLight) -> picStack( bg, trans(cwidth, cheight) * rot(180) -> moon, trans(cwidth / 2 - 50, cheight / 2 + 100) -> birds(8, 50), trans(0, cheight / 2) -> mountains(9) ) val pic = picStack( Picture.rectangle(cwidth, 50) .withFillColor(Color(44, 185, 255, 100)) .withTranslation(0, cheight / 2 - 25) .withPenColor(noColor), pic1, pic1.withFading(400).withBlurring(10).withFlippedY.withTranslation(0, -cheight + 3) ) draw(trans(-cwidth / 2, -cheight / 2) -> pic)
Your Comment: