Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Created July 29, 2019 17:54
Show Gist options
  • Save jamesmichiemo/6cfd46c93de3052a1fef16de0d1f99dd to your computer and use it in GitHub Desktop.
Save jamesmichiemo/6cfd46c93de3052a1fef16de0d1f99dd to your computer and use it in GitHub Desktop.
processing + propane sketch
#!/usr/bin/env jruby
# frozen_string_literal: false
require 'propane'
# robot 2
# propane graffiti by 8mana
# based on code by Casey Reas and Ben Fry
class RobotTwo < Propane::App
def settings
size 170, 480
end
def setup
sketch_title 'robot'
end
def draw
x = 60
y = 420
bodyHeight = 110
neckHeight = 140
radius = 45
ny = y - bodyHeight - neckHeight - radius
strokeWeight 2
background 204
ellipseMode RADIUS
# neck
stroke 102 # set stroke to gray
line x+2, y-bodyHeight, x+2, ny # left
line x+12, y-bodyHeight, x+12, ny # middle
line x+22, y-bodyHeight, x+22, ny # right
# antennae
line x+12, ny, x-18, ny-43 # small
line x+12, ny, x+42, ny-99 # tall
line x+12, ny, x+78, ny+15 # medium
# body
strokeWeight 0 # disable stroke
fill 102 # set fill to gray
ellipse x, y-33, 33, 33 # antigravity orb
fill 0 # set fill to black
rect x-45, y-bodyHeight, 90, bodyHeight-33 # main body
fill 102
rect x-45, y-bodyHeight+17, 90, 6
# head
fill 0 # set fill to black
ellipse x+12, ny, radius, radius # head
fill 255 # set fill to white
ellipse x+24, ny-6, 14, 14 # large eye
fill 0 # set fill to black
ellipse x+24, ny-6, 3, 3 # pupil
fill 153 # set fill to light gray
ellipse x, ny-8, 5, 5 # small eye 1
ellipse x+30, ny-26, 4, 4 # small eye 2
ellipse x+41, ny+6, 3, 3 # small eye 3
end
end
RobotTwo.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment