Last active
March 14, 2019 22:53
-
-
Save msafadieh/1308d4c41957e00b82a83224396152a7 to your computer and use it in GitHub Desktop.
cool racket graphics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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