tuioZones - animating zones problem
in
Contributed Library Questions
•
1 year ago
I made a simple sketch to show the problem. The aim is to move Zone to the left (using setZoneData) when it's not pressed on. It works until I try to drag it when it jumps to a point where I dropped it last time.
here's the code:
- import oscP5.*;
- import netP5.*;
- import tuioZones.*;
- TUIOzoneCollection zones;
- void setup() {
- size(640, 360);
- background(0);
- noFill();
- stroke(255);
- zones = new TUIOzoneCollection(this);
- zones.setZone("object1", 240, 180, 24);
- zones.setZoneParameter("object1", "DRAGGABLE", true);
- }
- void draw() {
- background(0);
- // draw the zone
- ellipse(
- zones.getZoneX("object1"),
- zones.getZoneY("object1"),
- zones.getZoneWidth("object1"),
- zones.getZoneHeight("object1")
- );
- // move the zone if it is not pressed and not out of frame
- if (!zones.isZonePressed("object1") && zones.getZoneX("object1") < width - 24) {
- zones.setZoneData(
- "object1",
- zones.getZoneX("object1") + 1,
- zones.getZoneY("object1"),
- 24
- );
- }
- }
tuioZones 0.2.0
Processing 2.0a6
thanks a lot!
1