circles-1
2012. 05. 08.

Click on the screen to spawn circles. Noises and randomness give a sketchy, hand-drawn look.

» launch circles-1

p5 = processing
r  = random

class Circle
  constructor: (@cx = r(p5.width), @cy = r(p5.height)) ->
    @r  = r TWO_PI
    @l  = @r + TWO_PI * r(0.5, 5)
    @d  = r 0.1,  0.13
    @s  = r 10,   50
    @sd = r 0.99, 1.005
    @w  = r 1,    4
    @n  = r 1.0
    @ns = r 0.1,  0.5
    @nd = r 0.3,  3.0

  alive: -> @r < @l

  live: ->
    s  = @s - @ns * @s * noise(@n, @r * @nd)
    @x = @cx + s * cos(@r)
    @y = @cy + s * sin(@r)
    line @px || @x, @py || @y, @x, @y

    @px = @x
    @py = @y

    @r += @d
    @s *= @sd

circles = []

setup = ->
  size         $(window).width(), $(window).height()
  frameRate    30
  background   255
  stroke       0
  strokeWeight 2

mousePressed = ->
  circles.push new Circle(p5.mouseX, p5.mouseY)

draw = ->
  circles =
    for c in circles when c.alive()
      c.live()
      c
» capture | close