Code Sketch
Polar bear
By: Soham Dabral
Category: Art
4


0




def mountain(n: Int) = Picture { beginShape() curveVertexRt(-300, 0) curveVertexRt(-300, 0) curveVertexRt(n, 100) curveVertexRt(n, 0) curveVertexRt(n, 0) endShape() } def mountains(n: Int, size: Double): Picture = { if (n == 1) { mountain(150) .withFillColor(mountainclr) .withPenColor(noColor) } else { picStack( mountain(120) .withPenColor(noColor) .withFillColor(mountainclr), mountains(n - 1, size) .withTranslation(200, 0) ) } } cleari() val assetsDir = "C:/Users/Soham/Downloads" val bg = Picture.image(s"$assetsDir/PB1.png") val PB1 = trans(-1000, 0) * scale(2) -> bg val sky = cm.linearGradient(0, 100, ColorMaker.hsl(201, 0.59, 0.94), 0, 200, ColorMaker.hsl(240, 1.00, 0.78), false) val sunclr = cm.radialGradient(0, 0, cm.white, 70, ColorMaker.hsl(240, 1.00, 0.78), false) val sunclr2 = cm.radialGradient(0, 0, cm.white, 70, ColorMaker.hsl(194, 0.43, 0.71), false) val mountainclr = cm.linearGradient(-55, 40, ColorMaker.hsl(120, 0.22, 0.89), 0, 0, ColorMaker.hsl(120, 0.06, 0.52), false) val pic = picStack( Picture.rectangle(850, 380) .withTranslation(-300, -380) .withPenColor(noColor) .withFillColor(ColorMaker.hsl(194, 0.43, 0.71)), Picture.rectangle(850, 380) .withTranslation(-300, 0) .withPenColor(noColor) .withFillColor(sky), mountains(3, 10) .withTranslation(0, -4) .withPenColor(noColor) .withPenThickness(0) .withBlurring(30) .withFading(110) .withFlippedY, Picture.circle(75) .withPenColor(noColor) .withTranslation(0, 239) .withFillColor(sunclr2) .withFading(220) .withFlippedY, Picture.circle(75) .withPenColor(noColor) .withTranslation(0, 270) .withFillColor(sunclr), mountains(3, 10), PB1 .withTranslation(100, -280), ) drawCentered(pic)





Your Comment:





Login to post a comment