Stefano wrote:Well, those VR examples was not made with WireFusion.
/Stefano
public void init() {
} private int prevX = 0;
private int arrayIndex = 0;
private int arrayIndexMax = 1;
public void inport_MouseDrag(double x, double y) {
if (x > prevX){
if (arrayIndex < arrayIndexMax - 1){arrayIndex ++;}
else{arrayIndex = 0;}
}
else if (x < prevX){
if (arrayIndex > 1){arrayIndex --;}
else{arrayIndex = arrayIndexMax;}
}
sendNumber("arrayIndex", arrayIndex);
}
//set number of available pictures
public void inport_setPictureCount(double arg) {
arrayIndexMax = (int) arg;
} private int prevX = 0;
private int arrayIndex = 0;
private int arrayIndexMax = 1;
public void inport_MouseDrag(double x, double y) {
if (x > prevX){
if (arrayIndex < arrayIndexMax){arrayIndex ++;}
else{arrayIndex = 0;}
}
else if (x < prevX){
if (arrayIndex > 0){arrayIndex --;}
else{arrayIndex = arrayIndexMax;}
}
prevX = (int)x;
sendNumber("arrayIndex", arrayIndex);
}
//set number of available pictures
public void inport_setStartPicture(double arg) {
arrayIndex = (int)arg;
sendNumber("arrayIndex", arrayIndex);
}
public void inport_setPictureCount(double arg) {
arrayIndexMax = (int)arg-1;
} private int prevX = 0;
private int arrayIndex = 0;
private int arrayIndexMax = 1;
private int rotatorWidth = 120;
public void inport_MouseDrag(double x, double y) {
int stepsApplied = Math.abs(((int) x - prevX)) / (rotatorWidth/arrayIndexMax);
//If this is first drag event, just get x so we know where we are. We'll rotate on next drag.
if (prevX != 0){
if (x > prevX){
if (arrayIndex < arrayIndexMax){arrayIndex += stepsApplied;}
else{arrayIndex = 0;}
}
else if (x < prevX){
if (arrayIndex > 0){arrayIndex -= stepsApplied;}
else{arrayIndex = arrayIndexMax;}
}
//just for testing
sendText("stepsApplied", "moved from " + prevX + " to " + x + " which is " + stepsApplied + " steps");
if (stepsApplied != 0) prevX = (int)x; //if the move was not large enough to constitute 1 step, just save our previous spot
sendNumber("arrayIndex", arrayIndex);
}
else{prevX = (int)x;}
}
//set number of available pictures
public void inport_setStartPicture(double arg) {
arrayIndex = (int)arg;
sendNumber("arrayIndex", arrayIndex);
}
public void inport_setPictureCount(double arg) {
arrayIndexMax = (int)arg-1;
}
public void inport_rotatorRollOff() {
prevX = 0;
}
public void inport_setRotatorWidth(double arg) {
rotatorWidth = (int)arg;
}Users browsing this forum: No registered users and 0 guests