front_processing/src/Interaction_examples/Hands_1D/Hands_1D.pde
author bastiena
Mon, 24 Sep 2012 15:20:10 +0200
changeset 124 d2b4682dc9cc
parent 41 d2f735d7763f
permissions -rw-r--r--
Étiquette V00.17 ajoutée à la révision 57a65edde708

/*
* This file is part of the TraKERS\Front Processing package.
*
* (c) IRI <http://www.iri.centrepompidou.fr/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/*Exemple tiré de processing.org*/

import TUIO.*;
TuioProcessing tuioClient;
int port = 8080;
//Taille de la fenêtre
int WIDTH = 640, HEIGHT = 480;

int gx = 15;
int gy = 35;
float leftColor = 0.0;
float rightColor = 0.0;

void setup()
{
  size(WIDTH, HEIGHT);
  tuioClient = new TuioProcessing(this, port);
  colorMode(RGB, 1.0);
  noStroke();
}

void draw()
{
  background(0.0);
  tuioInput();
  fill(0.0, leftColor + 0.4, leftColor + 0.6); 
  rect(width/4-gx, height/2-gx, gx*2, gx*2); 
  fill(0.0, rightColor + 0.2, rightColor + 0.4); 
  rect(width/1.33-gy, height/2-gy, gy*2, gy*2);
}

void update(int x)
{
  leftColor = -0.002 * x/2 + 0.06;
  rightColor =  0.002 * x/2 + 0.06;
	
  gx = x/2;
  gy = 100-x/2;

  if (gx < 10) {
    gx = 10;
  } else if (gx > 90) {
    gx = 90;
  }

  if (gy > 90) {
    gy = 90;
  } else if (gy < 10) {
    gy = 10;
  }
}