Code Sketch


School Bus
By: Riky Chowdhury
Category: Art
cleari()
showAxes()
val clr = cm.linearGradient(
    100,0,black,
    100,10,cyan)
    setBackground(clr)
    
def busbody(width:Int,height:Int): Picture = {
    Picture.rectangle(width,height)
}

val busbody1 = busbody(200,50).thatsTranslated(25,30).thatsFilledWith(yellow).thatsStrokeColored(black)

val busbody2 = busbody(200,50).thatsTranslated(25,80).thatsFilledWith(red).thatsStrokeColored(black)

val busbody3 = busbody(40,40).thatsFilledWith(white).thatsTranslated(30,85).thatsStrokeColored(black)

val busbody4 = busbody(40,40).thatsFilledWith(white).thatsTranslated(80,85).thatsStrokeColored(black)

val busbody5 = busbody(40,40).thatsFilledWith(white).thatsTranslated(130,85).thatsStrokeColored(black)

val busbody6 = busbody(40,40).thatsFilledWith(white).thatsStrokeColored(black).thatsTranslated(180,85)

val busbody7 = busbody(20,10).thatsFilledWith(black).thatsStrokeColored(black).thatsTranslated(5,30)

val body=picStack(busbody1,busbody2,busbody3,busbody4,busbody5,busbody6,busbody7)
draw(body)

def tyre(radius:Int): Picture = {
    Picture.circle(radius)
}

val tyre1 = tyre(25).thatsTranslated(60,30).withFillColor(black).thatsStrokeColored(black)

val tyre2 = tyre(25).thatsTranslated(190,30).withFillColor(black).thatsStrokeColored(black)

val tyre3 = tyre(5).thatsTranslated(60,30).withFillColor(white).thatsStrokeColored(white)

val tyre4 = tyre(5).thatsTranslated(190,30).withFillColor(white).thatsStrokeColored(white)

val bus=picStack(tyre1,tyre2,tyre3,tyre4)
draw(bus)