Skip to content

Instantly share code, notes, and snippets.

@shiffman
shiffman / index.html
Created August 27, 2015 03:46
adjusted size and css
<!doctype html>
<html>
<head>
<script language="javascript" src="p5.js"></script>
<script language="javascript" src="sketch.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
// Trilateration
// from: http://en.wikipedia.org/wiki/Trilateration
// Daniel Shiffman <http://www.shiffman.net>
// April 2006
// Updating for Processing 2.1, Jan 2014
PVector p1,p2,p3;
float d1,d2,d3;
PVector it;
// Perlin Noise Blob
// Polar to Cartesian Coordinates
// Daniel Shiffman
// Nature of Code, Spring 2014
float yoff = 0.0;
void setup() {
size(640,360);
}
function setup() {
}
/*
[ {
"name": "Morgan",
"age": "30",
"location": "Boston",
"desire": "Singing",
"fear": "Violence"
},
{
"name": "Joss",
@shiffman
shiffman / everyNframes.pde
Created September 11, 2014 02:04
every N frames
color c = color(0);
void setup() {
size(200, 200);
}
void draw() {
background(c);
// % is the remainder http://processing.org/reference/modulo.html
@shiffman
shiffman / checkerboard.pde
Created September 26, 2014 16:46
Checkerboard Pattern
void setup () {
size (400, 400);
}
void draw () {
background (0);
int spacing = 10;
noStroke();
int cols = width / spacing;
int rows = height / spacing;
@shiffman
shiffman / ParseCommas.pde
Created October 28, 2014 20:48
Parsing numbers with commas, what a pain
import java.text.NumberFormat;
String s = "256,128";
int val = int(s.replaceAll(",",""));
println(val);
int val2 = 0;
NumberFormat nf = NumberFormat.getNumberInstance(java.util.Locale.US);
// Daniel Shiffman
// Programming from A to Z, Fall 2014
// https://github.com/shiffman/Programming-from-A-to-Z-F14
// This examples builds a very simple DOM visualization of concordance
// It reads the text one word a a time and animates the words growing according to their counts
var concordance;
var wutang;
var canvas;
@shiffman
shiffman / dynamiccursor.pde
Created November 15, 2014 18:16
Dynamic Cursor
PGraphics canvas;
void setup() {
canvas = createGraphics(20, 20);
}
void draw() {
background(255);
canvas.beginDraw();
canvas.background(0);