Last active
August 9, 2019 15:55
-
-
Save jamesmichiemo/a1f6845d33675c2cce1b29e690b06b7c to your computer and use it in GitHub Desktop.
processing + propane sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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