Created
April 1, 2016 06:24
-
-
Save kencoba/a5d0feb113ab292f22b401dcee8797f1 to your computer and use it in GitHub Desktop.
Generative Art1
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
(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