Personal tools

Eth0:2008 Summer/Freej/scripts

From Eth0Wiki

Revision as of 13:53, 19 January 2010 by Stitch (talk | contribs)
Jump to: navigation, search
Eth0oldlogo.jpg
[POST-EVENT] This is information about the Eth0:2008 Summer Edition. [POST-EVENT]
Eth0oldlogo.jpg


wiimote dingetje :

include("param.js");
param = new Array();
param[0] = new Param(this, "px",  100,     150,    0,       100,       10);
param[1] = new Param(this, "py",  100,     150,    0,       100,       0);
param[2] = new Param(this, "pz",  100,     150,    0,       100,       0); 

// met die paramshit zetten we waardes tussen 0-100 voor de wiimote waardes

wii = new WiiController(); 

px = 0; py = 0; pz = 0;
x = 0; y = 0; z = 0;
ox = 0; oy = 0; oz = 0;
framec = 24; 
threshold = 25;
// met threshold stel je de gevoeligheid in

wiimote = '00:19:1D:66:91:D3' ;
// dit is het mac adres van je wiimote

videofile = '/home/buzz/VJ/video.avi'; 
// laat dit naar een videotje wijzen
 
wii.acceleration = function(ax,ay,az) {
        param[0].setValue(ax);
        param[1].setValue(ay);
        param[2].setValue(az);
        x = param[0].out_value;
        y = param[1].out_value;
        z = param[2].out_value;
}

if(wii.connect(wiimote))
   register_controller(wii);

kbd = new KeyboardController();
kbd.pressed_esc = function() { quit(); }
kbd.released_q = function() { quit(); }
register_controller( kbd ); 

movie = new MovieLayer(videofile);
add_layer(movie);

bang = new TriggerController();
register_controller(bang);
bang.frame = function() {
   if(framec>0) {
       framec--;
   } else {
       // je kan hier heel veel doen, dit doet iets met blit methodes

       if (x>(ox+threshold)) {
               movie.set_blit("REDMASK");
               movie.set_blit_value((100-x)/100);
               echo("f\n");
       }
       if (x<(ox-threshold)) {
               movie.set_blit("REDMASK");
               movie.set_blit_value(x/100);
               echo("r\n");
       }
       if (z>(oz+threshold)) {
               movie.set_blit("GREENMASK");
               movie.set_blit_value((100-z)/100);
               echo("z- f\n");
       }
       if (z<(oz-threshold)) {
               movie.set_blit("REDMASK");
               movie.set_blit_value(z/100);
               echo("z- r\n");
       }
       ox = x;
       oy = y;
       oz = z; 
     }
}