Skip to content

Instantly share code, notes, and snippets.

@REAS
REAS / LatentSpace_to_Diagram_01.pde
Last active September 10, 2018 21:26
Converts a JSON file with values from -1 to 1 into a line of gray rectangles
float[] latentspace;
String s = "RandGen_20180904-201026_00036"; // JSON file name
void setup() {
size(1000, 100);
loadData();
int w = 10;
int h = 100;
for (int i = 0; i < latentspace.length; i++) {
float g = map(latentspace[i], -1, 1, 0, 255);
@REAS
REAS / LatentSpace_to_Diagram_02.pde
Created September 11, 2018 20:47
Converts a JSON file with values from -1 to 1 into a line of rectangles moving through hues from orange to blue
float[] latentspace;
String s = "RandGen_20180904-201026_00036"; // JSON file name
void setup() {
size(1000, 100);
colorMode(HSB, 360, 100, 100);
loadData();
int w = 10;
int h = 100;
for (int i = 0; i < latentspace.length; i++) {
@REAS
REAS / PDF_Example_02.pde
Last active October 12, 2018 23:41
Create a PDF file with mouse press
import processing.pdf.*; // Import PDF code
boolean recordPDF = false;
int count = 0;
void setup() {
size(600, 600);
}
void draw() {
@REAS
REAS / PDF_Example_01.pde
Last active October 12, 2018 23:43
Create a PDF file and draw to the screen
import processing.pdf.*; // Import PDF code
void setup() {
size(600, 600);
noLoop(); // Run the draw() only once
}
void draw() {
beginRecord(PDF, "line.pdf"); // Start writing to PDF
// START PATTERN
@REAS
REAS / WaveWorm.pde
Last active September 27, 2020 15:30
Rainbow software simulation of mechanical sine wave machine, written at the Exploratorium
// I think there's a bug in here
float magnitude = 0;
float baseAngle = 0;
int lineSpacer = 4;
int yOffset = 80;
float cx;
float cy;
float newcx;