asobi

Ruby · creative coding · v0.1.0

asobi

Play with pictures in Ruby. Hold them, copy them, arrange them.

gem install asobi

gem install asobi, then type asobi in a terminal. A sketch opens in your browser.

require "asobi"
 
flower = petal(40, 16).repeat(10).in_fan.colored(from: :hotpink, to: :gold, around: true)
comet = circle(4).colored(:white).orbit(62, every: 6).trail(12)
sky = flower.animate(2) { |f, t| f.rotate(t * 36) } + comet
 
show sky.glowing, on: :black, grain: true

Now playing: asobi.rb

01 / What asobi believes

What asobi believes

  1. 01

    Treat objects as pictures, and pictures as objects.

  2. 02

    What matters is that it is fun to write, easy to follow, and instantly playable.

  3. 03

    A picture is like a sticker: make it, copy it, arrange it, and you still have one picture.

02 / step

One word at a time

Every step is a whole sketch. Add one word, and the picture answers.

  1. A shape.

    show petal
    
    Open in playground
  2. Eight of them, all in one place.

    show petal.repeat(8)
    
    Open in playground
  3. Arranged in a fan.

    show petal.repeat(8).in_fan
    
    Open in playground
  4. Two colours take turns.

    show petal.repeat(8).in_fan.colored(:deeppink, :cyan)
    
    Open in playground
  5. It glows, on black.

    show petal.repeat(8).in_fan.colored(:deeppink, :cyan).glowing, on: :black
    
    Open in playground
  6. And it moves.

    show petal.repeat(8).in_fan.colored(:deeppink, :cyan).glowing.spin(every: 8), on: :black
    
    Open in playground

03 / Examples

From the gallery

All examples

04 / Reference

Every word, one page

71 words in 9 groups. Each one with a picture that runs.