-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathViewPort.pde
42 lines (36 loc) · 1.04 KB
/
ViewPort.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* This example makes a simple view port, of which the image
* below can be dragged, it uses an indirect zone which will
* only render its contents inside its boundries as a texture
*/
import vialab.SMT.*;
void setup(){
//initial setup
size(displayWidth, displayHeight, P3D);
SMT.init(this, TouchSource.MULTIPLE);
//create zones
Zone viewport = new ContainerZone("ViewPort", displayWidth/4, displayHeight/4, displayWidth/2, displayHeight/2);
Zone moving = new Zone("MovingZone", 0, 0, displayWidth/2, displayHeight/2);
//add zones and stuff
SMT.add( viewport);
viewport.setDirect(false);
viewport.add( moving);
//add little flower pics
moving.add( new ImageZone(loadImage("0.jpg"), 50, 50, 50, 50));
moving.add( new ImageZone(loadImage("0.jpg"), 150, 150, 50, 50));
}
//function definitions
void drawViewPort( Zone zone){
fill(0);
rect(0, 0, zone.width, zone.height);
}
void drawMovingZone( Zone zone){
fill(0);
rect(0, 0, zone.width, zone.height);
}
void touchMovingZone( Zone zone){
zone.hSwipe();
}
void draw(){
background(44);
}