Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Created August 10, 2019 01:59
Show Gist options
  • Save jamesmichiemo/0aa4b988bfe073d958f5bcedca1c598e to your computer and use it in GitHub Desktop.
Save jamesmichiemo/0aa4b988bfe073d958f5bcedca1c598e to your computer and use it in GitHub Desktop.
processing + propane sketch
#!/usr/bin/env jruby
# frozen_string_literal: false
require 'propane'
# the bounds of a rectangle
# propane graffiti by 8mana
# based on code by Casey Reas and Ben Fry
class RectangleBounds < Propane::App
def settings
size 240, 120
end
def setup
sketch_title 'the bounds of a rectangle'
$x = 80
$y = 30
$w = 80
$h = 60
end
def draw
background 204
if ((mouseX > $x) && (mouseX < $x+$w) &&
(mouseY > $y) && (mouseY < $y+$h))
fill 0
else
fill 255
end
rect $x, $y, $w, $h
end
end
RectangleBounds.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment