A Processing.js sketch that highlights multiple things:
- How to use a mostly transparent circle as a cursor
- Detecting mouse events, such as hovering over a circle and taking action upon mouse clicks
| #!/usr/bin/env python | |
| import subprocess | |
| import httplib, urllib | |
| tempfile = open('/Users/macklinu/Documents/Scripts/.externalip/temp.txt', 'r+') | |
| currentip = subprocess.Popen(['curl', 'ifconfig.me/ip'], stdout=subprocess.PIPE).communicate()[0].replace('\n', '') | |
| def main(): | |
| checkIP() |
| //A class created for CSV parsing based on... | |
| //for importing csv files into a 2d array | |
| //by che-wei wang | |
| class CSV { | |
| String dataFile; | |
| String lines[]; | |
| String [][] csv; | |
| int csvWidth; |
| class MusicObject { | |
| AudioPlayer song; | |
| AudioMetaData meta; | |
| String artist; | |
| String title; | |
| String year; | |
| String info; | |
| PImage albumArt; | |
| String finalImgLoc; |
| import ddf.minim.*; | |
| Minim minim; | |
| AudioPlayer groove; | |
| AudioMetaData meta; | |
| void setup() | |
| { | |
| size(512, 256, P3D); |
| // THIS... | |
| if (dist(mouseX, mouseY, X2 - 35, Y2 - 35) < 10) fill(190, 190); | |
| else fill(90, 190); | |
| // BECOMES... | |
| fill(dist(mouseX, mouseY, X2 - 35, Y2 - 35) < 10 ? 190 : 90, 190); |
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <style> | |
| body { | |
| font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
| margin: auto; | |
| position: relative; | |
| width: 960px; | |
| } |
| [ | |
| { | |
| "Src": "nn", | |
| "Eqid": "00398227", | |
| "Version": "9", | |
| "Datetime": "Wednesday, January 2, 2013 21:55:02 UTC", | |
| "Lat": "38.3558", | |
| "Lon": "-118.7655", | |
| "Magnitude": "1.9", | |
| "Depth": "15.80", |
A Processing.js sketch that highlights multiple things:
| // Winter Forest | |
| // Include this line if using Processing.js | |
| /* @pjs pauseOnBlur="true"; */ | |
| float wiggle = 0; | |
| float angle = -1.0; | |
| void setup() { | |
| size(700, 250); |
| // Swirling Color Wheel | |
| // p.js | |
| // | |
| // Just discovering how to make this effect | |
| // thanks to HSB vs. RGB color mode | |
| // | |
| // Click on the sketch to switch color modes | |
| /* @pjs pauseOnBlur="true"; */ |