Processing
eartsup 15/03/2017
Librairie pour les gif animés à télécharger : https://github.com/01010101/GifAnimation
Sons jeux vidéos : http://www.universal-soundbank.com/jeux-videos.htm
Sketchs jeux vidéos :
Sketch SpaceInvaders
simple pong
Pong double
eartsup 08/02/2017
- brief-eartsup-design interactif fev 2017
- Code Video Webcam Pixel
- Code Tracking Couleur
- Code Tracking visage
Code 3D Cabannes :
// cabanes à la Franck int nb_minimum=6; // nombre d'element minimum int nb_maximum=20; // nombre maximal d'element long lerandom; void setup() { size(1200, 800, P3D); smooth(); newseed(); } void draw() { background(255); stroke(1); fill(255); directionalLight(210, 210, 210, -1, 1, 0); ambientLight(120, 120, 120); randomSeed(lerandom); // translate(width/2, 0, 250); translate(width/2, 0, mouseY-250); rotateY(map(mouseX, 0, width, 0, TWO_PI)); int nbc=int(random(nb_minimum, nb_maximum)); // nombre d'elements for (int i=0;i<nbc;i++) { pushMatrix(); float largeur, hauteur; float type=random(10); // pilier ou plateau ? if (type>5) { // plateau largeur=random(250, 400); hauteur=random(2, 10); translate(random(-300, 300), height-random(50, 500), random(-30, 30)); } else { // pilier largeur=random(10, 30); hauteur=random(200, 400); translate(random(-300, 300), height-hauteur, random(-30, 30)); } box(largeur, hauteur, largeur); popMatrix(); } // sol fill(200); noStroke(); translate(0, height, 0); box(width*2, 2, width*2); } void keyPressed() { if(key==' '){ newseed(); } } void newseed() { lerandom=int(random(1000)); }
Code utilisation webcam :
import processing.video.*; Capture cam; void setup() { size(640, 480); String[] cameras = Capture.list(); if (cameras.length == 0) { println("There are no cameras available for capture."); exit(); } else { println("Available cameras:"); for (int i = 0; i < cameras.length; i++) { println(cameras[i]); } // The camera can be initialized directly using an // element from the array returned by list(): cam = new Capture(this, cameras[0]); cam.start(); } } void draw() { if (cam.available() == true) { cam.read(); } set(0, 0, cam); }
Débuter avec Processing
Brief pour projet animation interactive
Etudiants ayant rendu le TP : Nicolas Ferru, Florian Marques, Axel Raynaud, Nicolas Reos, Mathilde Delcroix Rongier, Charlotte Forsans, Thomas Lubbrano Di Ziranaldi, Marine Rougagnou, Charly Hilarion, Quentin Guichard, Solenn Gras, Anja Razafimbelo, Amélie Anne Laleque, Etienne Bellé, Thuylinh Vaudelle, Yann Gregoire, Alexandre Barbier, Lara Damiens, Baysset Rémi, Roméo AMOUSSOU
Code pour analyse du volume sonore
import ddf.minim.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; import ddf.minim.signals.*; import ddf.minim.spi.*; import ddf.minim.ugens.*; float volume; float seuil=5.0; float moyenne=0; int tampon=10; Minim minim; AudioInput in; void setup(){ size(640,480); frameRate(30); minim = new Minim(this); in = minim.getLineIn(Minim.STEREO,16); noStroke(); } void draw(){ background(0); volume = in.mix.level()*5; moyenne=((moyenne*tampon)+volume)/(tampon+1); float vF = map(moyenne,0,seuil,0,width); ellipse(width/2,height/2,vF,vF); fill(0,255,0); text("volume : "+volume,5,30); text("moyenne : "+moyenne,5,60); }
TP8
float totalPts = 600; void setup(){ size(640,360); frameRate(30); stroke(255); } void draw(){ background(0); float aleatoire = 0; for(int i=1; i < totalPts;i++ ){ point((width/totalPts)*i,(height/2) + random(-aleatoire,aleatoire) ); //aleatoire = aleatoire + random(-5,5); aleatoire = aleatoire + random(-mouseX/50,mouseX/50); } }