Ronin experiment 4 - wiggly

Nikolaus Gradwohl2019-07-20T10:09:12+00:00

ronin experiment no 4: a wiggly line created using a recursive lisp function only updating every n milliseconds to slow down the animation

wiggly line

This is the code I used to create the animation

; wiggly
; divide integer
(defn divi (a b) (div (sub a (mod a b)) b))
; create list of random numbers
(def rnd (map (lambda (a)
(random -1 5))
(range 1 100)))
; use rnd list to draw 
(defn rec (px py rnd)
  (if (gt (len rnd) 0) (
    (stroke (circle px py (add 10 (div (first rnd) 5))) 1 "white")
    (add px (first rnd))
    (add py (first (rest rnd)))
    (rest (rest rnd))
; slow down animation
(if (eq (mod (divi (time) 10) 25) 0) (
  (rec 100 100 rnd))
Tweet This! submit to reddit Digg! Tags: | no comments | no trackbacks

See also:

Ronin experiment 21 - morphing lissajous states
ronin experiment 20 - transform flower
ronin experiment 19 - Sonic Pi visualizer
Ronin experiment 18 - Rainbow
Ronin experiment 17 - boids



Leave a response

Leave a comment