Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Last active August 9, 2019 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmichiemo/a1f6845d33675c2cce1b29e690b06b7c to your computer and use it in GitHub Desktop.
Save jamesmichiemo/a1f6845d33675c2cce1b29e690b06b7c to your computer and use it in GitHub Desktop.
processing + propane sketch
#!/usr/bin/env jruby
# frozen_string_literal: false
require 'propane'
# find the cursor
# propane graffiti by 8mana
# based on code by Casey Reas and Ben Fry
class FindCursor < Propane::App
def settings
size 240, 120
end
def setup
sketch_title 'find the cursor'
$x = width/2
$offset = 10
end
def draw
background 204
if mouseX > $x
$x += 0.5
$offset = -10
end
if mouseX < $x
$x -= 0.5
$offset = 10
end
line $x, 0, $x, height
line mouseX, mouseY, mouseX + $offset, mouseY - 10
line mouseX, mouseY, mouseX + $offset, mouseY + 10
line mouseX, mouseY, mouseX + $offset*3, mouseY
end
end
FindCursor.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment