FLIP FLOP_broderie

FLIP FLOP_broderie

Utiliser le logiciel Processing comme fabriquant d’image puis « l’imprimer » sur brodeuse numérique

schema_brodeuse_numerique

 

il est possible d’utiliser plusieurs couleurs via différents calques

brodeuse_numerique LIVE ! from Studio Objet Augmente on Vimeo.

//CODEFlipFlop//

import processing.pdf.*;
import java.util.Calendar;

boolean recordPDF = false;

int NORD = 0;
int NORDEST = 1;
int EST = 2;
int SUDEST = 3;
int SUD = 4;
int SUDOUEST = 5;
int OUEST = 6;
int NORDOUEST= 7;

float pas = 14;
float diametre = 9;
int direction;
float posX, posY;
void setup() {
size(800, 800);
background(255);
noStroke();
posX = random(width);
posY = random(height);
}
void draw() {
for (int i=0; i<=mouseX; i++) {
direction = (int) random(0, 4);

if (direction == NORD) {
posY -= pas;
} else if (direction == NORDEST) {
posX += pas;
posY -= pas;
} else if (direction == EST) {
posX += pas;
} else if (direction == SUDEST) {
posX += pas;
posY += pas;
} else if (direction == SUD) {
posY += pas;
} else if (direction == SUDOUEST) {
posX -= pas;
posY += pas;
} else if (direction == OUEST) {
posX -= pas;
} else if (direction == NORDOUEST) {
posX -= pas;
posY -= pas;
}

if (posX > width) posX = 0;
if (posX < 0) posX = width;
if (posY < 0) posY = height;
if (posY > height) posY = 0;

fill(30,100);
rect(posX+pas/2, posY+pas/2, diametre, diametre);
}
}
void keyReleased() {
if (key == DELETE || key == BACKSPACE) background(255);
if (key == 's' || key == 'S') saveFrame(timestamp()+"_##.png");

// ------ pdf export ------
// press 'r' to start pdf recording and 'e' to stop it
// ONLY by pressing 'e' the pdf is saved to disk!
if (key =='r' || key =='R') {
if (recordPDF == false) {
beginRecord(PDF, timestamp()+".pdf");
println("recording started");
recordPDF = true;
background(255);
noStroke();
posX = width/2;
posY = height/2;
}
} else if (key == 'e' || key =='E') {
if (recordPDF) {
println("recording stopped");
endRecord();
recordPDF = false;
background(255);
}
}
}
// timestamp
String timestamp() {
Calendar now = Calendar.getInstance();
return String.format("%1$ty%1$tm%1$td_%1$tH%1$tM%1$tS", now);
}