Reply To: Leap Motion

Accueil Forums Créer avec IanniX Leap Motion Reply To: Leap Motion

#3287
IanniX
Maître des clés

No 🙂 I used LeapOSC (https://github.com/odbol/LeapOSC) and this score :

var curvePointIndex = 0, previousFinger = false, previousFingerCounter = 50;;
function onIncomingMessage(protocol, host, port, destination, values) {
	if(previousFingerCounter <= 0) {
		if(previousFinger) {
			if(curvePointIndex > 140) {
				run("add cursor auto");
				run("setCurve current lastCurve");
				run("setPattern current 0 0 1 -1");
				run("play");
			}
			else
				run("remove lastcurve");
			previousFinger = false;
			previousFingerCounter = 50;
		}
	}
	if(destination.startsWith("/hand/0/direction")) {
		previousFingerCounter--;
	}
	else if(destination.startsWith("/hand/0/finger/0/pos")) {
		if(!previousFinger) {
			previousFinger = true;
			curvePointIndex = 0;
			run("add curve auto");
			run("setColorHue current " + random(0, 255) + " 255 200 255");
		}
		previousFingerCounter = 50;
		run("setSmoothPointAt current " + (curvePointIndex++) + " " +
			map(values[0], -200,  200, -5, 5) + " " +
			map(values[2],  100, -100, -5, 5) + " " + 
			map(values[1],    0,  300, -5, 5));
	}
	else if(destination.startsWith("/hand/0/finger/4")) {
		previousFinger = false;
		previousFingerCounter = 50;
		run("clear");
	}
}

© IanniX Association

Qu'est-ce que IanniX ? | Téléchargement | Showcase | Forum | Recherche | À propos