Skip to content

Instantly share code, notes, and snippets.

@msafadieh msafadieh/stars.rkt
Last active Mar 14, 2019

Embed
What would you like to do?
cool racket graphics
#lang racket
(require 2htdp/image)
(require 2htdp/universe)
(define (polygons n)
(let* ([random-color (lambda () (color (random 255) (random 255) (random 255)))]
[random-polygon (lambda (x) (star-polygon (* (add1 x) 30) (random 12 16) 11 'solid (random-color)))]
[polygons-list (build-list n random-polygon)]
[background (square (* 150 n) 'solid (random-color))])
(foldr overlay background polygons-list)))
(big-bang 5
[name "Stars"]
[to-draw polygons]
[on-tick identity 0.5])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.