Hi, I am a new user for the layers library.
It is great idea to add this function in process.
I was trying in my application.
My application have two layers.
one is for drawing.
the other is for webcam image.
I am wondering is there a way to record these 2 layers separated and save as quick time in a same folder?
Here is my code.
Any help will be appreciated.
--------------------------------------------------------------------------------------------------------------------
import com.nootropic.processing.layers.*;
AppletLayers layers;
import processing.video.*;
Capture myCapture;
MovieMaker mm;
void setup() {
size(400, 300);
layers = new AppletLayers(this);
MyLayer m = new MyLayer(this);
layers.addLayer(m);
myCapture = new Capture(this, width, height, 30);
mm = new MovieMaker(this, width, height, "D:/test move/webcam.mov",
15, MovieMaker.H263, MovieMaker.HIGH);
}
void captureEvent(Capture myCapture) {
myCapture.read();
}
// paint method for Processing versions prior to 1.5
void paint() {
// This method MUST be present in your sketch for layers to be rendered!
if (layers != null) {
layers.paint(this);
} else {
super.paint();
}
}
void draw() {
image(myCapture, 0, 0);
mm.addFrame();
}
void keyPressed() {
if (key == ' ') {
mm.finish(); // Finish the movie if space bar is pressed!
exit();
}
}
-----------------------------------------------------------------------------------------------
class MyLayer extends Layer {
MyLayer(PApplet parent) {
super(parent); // This is necessary!
}
void setup(){
smooth();
}
void draw() {
stroke(0);
if(mousePressed) {
stroke(140);
line(mouseX, mouseY, pmouseX, pmouseY);
}
}
}
It is great idea to add this function in process.
I was trying in my application.
My application have two layers.
one is for drawing.
the other is for webcam image.
I am wondering is there a way to record these 2 layers separated and save as quick time in a same folder?
Here is my code.
Any help will be appreciated.
--------------------------------------------------------------------------------------------------------------------
import com.nootropic.processing.layers.*;
AppletLayers layers;
import processing.video.*;
Capture myCapture;
MovieMaker mm;
void setup() {
size(400, 300);
layers = new AppletLayers(this);
MyLayer m = new MyLayer(this);
layers.addLayer(m);
myCapture = new Capture(this, width, height, 30);
mm = new MovieMaker(this, width, height, "D:/test move/webcam.mov",
15, MovieMaker.H263, MovieMaker.HIGH);
}
void captureEvent(Capture myCapture) {
myCapture.read();
}
// paint method for Processing versions prior to 1.5
void paint() {
// This method MUST be present in your sketch for layers to be rendered!
if (layers != null) {
layers.paint(this);
} else {
super.paint();
}
}
void draw() {
image(myCapture, 0, 0);
mm.addFrame();
}
void keyPressed() {
if (key == ' ') {
mm.finish(); // Finish the movie if space bar is pressed!
exit();
}
}
-----------------------------------------------------------------------------------------------
class MyLayer extends Layer {
MyLayer(PApplet parent) {
super(parent); // This is necessary!
}
void setup(){
smooth();
}
void draw() {
stroke(0);
if(mousePressed) {
stroke(140);
line(mouseX, mouseY, pmouseX, pmouseY);
}
}
}
1