Code Sketch


Star-Pattern
By: Nitin Mishra
val filter = new com.jhlabs.image.NoiseFilter
val star = Picture {
    repeat(5) {
        forward(10)
        right(144)
        forward(10)
        left(72)
    }
}
    //.withRotation(-10)
    .withPenColor(noColor)
    .withFillColor(purple)
    //.withEffect(filter)


def stars(n: Int): Picture = {
    if (n <= 10) {
        star
    }
    else {

        picStack(
            star,
            stars(n - 1).withScaling(1.15).withTranslation(20, 0)
        )
    }
}
val colStar = stars(15)
def cirStar(n: Int): Picture = {
    if (n <= 0) {
        colStar
    }
    else {
        picStack(
            colStar,
            cirStar(n - 12).withRotation(30)
        )
    }
}

cleari
draw(cirStar(360))