Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Created May 29, 2019 04:27
Show Gist options
  • Select an option

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

Select an option

Save jamesmichiemo/d8f2bae8bb68048bc59057c11b1474c7 to your computer and use it in GitHub Desktop.
p5 the processing robot
#!/usr/bin/env jruby
# frozen_string_literal: false
require 'propane'
# robot
# propane graffiti by 8mana
# based on code by Casey Reas and Ben Fry
class Robot < Propane::App
def settings
size 720, 480
end
def setup
sketch_title 'robot'
end
def draw
strokeWeight 2
background 204
ellipseMode RADIUS
# neck
stroke 102 # set stroke to gray
line 266, 257, 266, 162 # left
line 276, 257, 276, 162 # middle
line 286, 257, 286, 162 # right
# antennae
line 276, 155, 246, 112 # small
line 276, 155, 306, 56 # tall
line 276, 155, 342, 170 # medium
# body
strokeWeight 0 # disable stroke
fill 102 # set fill to gray
ellipse 264, 377, 33, 33 # antigravity orb
fill 0 # set fill to black
rect 219, 257, 90, 120 # main body
fill 102
rect 219, 274, 90, 6
# head
fill 0 # set fill to black
ellipse 276, 155, 45, 45 # head
fill 255 # set fill to white
ellipse 288, 150, 14, 14 # large eye
fill 0 # set fill to black
ellipse 288, 150, 3, 3 # pupil
fill 153 # set fill to light gray
ellipse 263, 148, 5, 5 # small eye 1
ellipse 296, 130, 4, 4 # small eye 2
ellipse 305, 162, 3, 3 # small eye 3
end
end
Robot.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment