Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Created June 12, 2019 00:44
Show Gist options
  • Select an option

  • Save jamesmichiemo/54b247241dbf3b1dd0f57dfb9a0ac926 to your computer and use it in GitHub Desktop.

Select an option

Save jamesmichiemo/54b247241dbf3b1dd0f57dfb9a0ac926 to your computer and use it in GitHub Desktop.
propane sketch
#!/usr/bin/env jruby
# frozen_string_literal: false
require 'propane'
# owls of different sizes
# propane graffiti by 8mana
# based on code by Casey Reas and Ben Fry
class SizeOwls < Propane::App
def settings
size 480, 120
end
def setup
sketch_title "owls of different sizes"
end
def draw
background 204
random_seed 0
i = 35
while i < width + 40 do
gray = rand 102
scalar = rand 0.25..1.0
owl i, 110, gray, scalar
i += 40
end
end
def owl(x,y,g,s)
push_matrix
translate x, y
scale s
stroke g
stroke_weight 70
line 0, -35, 0, -65 # body
no_stroke
fill 255-g
ellipse -17.5, -65, 35, 35 # left eye dome
ellipse 17.5, -65, 35, 35 # right eye dome
arc 0, -65, 70, 70, 0, PI # chin
fill g
ellipse -14, -65, 8, 8 # left eye
ellipse 14, -65, 8, 8 # right eye
quad 0, -58, 4, -51, 0, -44, -4, -51 # beak
pop_matrix
end
end
SizeOwls.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment