Skip to content

Instantly share code, notes, and snippets.

@kencoba
Created April 1, 2016 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kencoba/a5d0feb113ab292f22b401dcee8797f1 to your computer and use it in GitHub Desktop.
Save kencoba/a5d0feb113ab292f22b401dcee8797f1 to your computer and use it in GitHub Desktop.
Generative Art1
(in-package :vecto)
(defun ball (ratio)
(set-line-width 1)
(dotimes (i 5000)
(set-rgba-stroke 0 0 (random 1) 0.05)
(with-graphics-state
(rotate (* i (random 10)))
(translate (- (random 40) 20) (- (random 20) 10))
(move-to (+ (random (* ratio 20))) (random 10))
(line-to (+ (random (* ratio 5))) (random 1))
(stroke))))
(defun art1 (file)
(let ((width 1000)
(height 1000))
(with-canvas (:width width :height height)
(translate (/ width 2) (/ height 2))
(set-rgb-fill 1 1 1)
(rectangle (- width) (- height) (* width 2) (* height 2))
(fill-path)
(do ((r 1 (+ r (random 10))))
((> r 100))
(rotate 1)
(translate r 0)
(ball r))
(save-png file))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment