Control Keystone Layers seperately
in
Contributed Library Questions
•
1 year ago
Hallo,
I'm working with the Keystone Library and I want to move and control the two layers seperately. So when pressing 'c' I only want to move and control the red layer and when pressing 'v' only the green layer should be moved.
As it's much easier to control the position of the layers when only one layer is selected.
I hope you guys may help me!!! When executing my script both layers are moveable when pressing either 'c' oder 'v'.
- import deadpixel.keystone.*;
- Keystone ksRed;
- Keystone ksGreen;
- CornerPinSurface surfaceRed, surfaceGreen;
- PGraphics offscreenRed, offscreenGreen;
- void setup() {
- size(800, 600, P3D);
- ksRed = new Keystone(this);
- ksGreen = new Keystone(this);
- surfaceRed = ksRed.createCornerPinSurface(400, 300, 20);
- offscreenRed = createGraphics(400, 300, P2D);
- surfaceGreen = ksGreen.createCornerPinSurface(200, 150, 20);
- offscreenGreen = createGraphics(200, 150, P2D);
- }
- void draw() {
- offscreenRed.beginDraw();
- offscreenRed.background(255, 30, 0);
- offscreenRed.endDraw();
- offscreenGreen.beginDraw();
- offscreenGreen.background(0, 255, 30);
- offscreenGreen.endDraw();
- background(0);
- surfaceRed.render(offscreenRed);
- surfaceGreen.render(offscreenGreen);
- }
- void keyPressed() {
- switch(key) {
- case 'c':
- ksGreen.toggleCalibration();
- break;
- case 'v':
- ksRed.toggleCalibration();
- break;
- }
- }
1