hi all,
i am trying to create a movie file with an embedded alpha channel - is this possible?
i have started by trying to take the approach of exporting a graphic each frame as a .png image and then reassembling these in quicktime; problem is:
1. I can't seem to get the pg.saveFrame() option working for exporting the graphic; it will only do pg.save() which overwrites the file every frame; not much use
2. the image produced doesn't have the background, which is great but the rest of the graphic's pixels don't have any transparency/alpha channel quality to them; they are solid; i want them to have the transparency they are drawn with
any pointers anyone?
thanks
S
Quote:import processing.pdf.*;
PGraphics pg;
ArrayList drops;
float X = random(0,width);
float Y = random(0,height);
int raining;
int a = 5000;
PFont font;
boolean faster=true;
void setup(){
size(1680,1050);
drops = new ArrayList();
pg = createGraphics(width, height, JAVA2D);
font = loadFont("Surface-Medium-13.vlw");
textFont( font );
}
void draw(){
pg.beginDraw();
pg.smooth();
background(0);
//beginRecord(PDF, "droplets-####.pdf");
//fill(0,200);
//text("mouse over a droplet to delete it",10,10);
for (int j = drops.size()-1; j >= 0; j--) {
Drop drop = (Drop) drops.get(j);
drop.drawdrop();
if (drop.finished()){
drops.remove(j);
}}
if (millis() - raining > (random(0,a))){
rain();
raining = millis();
if (a<=-12000){
faster = false;}
if(a>=5000){
faster = true;}
if (faster){
a = a-100;}
else{ a=a+100;}
}
pg.endDraw();
image(pg, 0, 0);
pg.save("droplets-####.png");
//endRecord();
}
void rain(){
X = random(0,width);
Y = random(0,height);
drops.add(new Drop(X,Y));
}
Quote:class Drop{
int xpos;
int ypos;
float i;
int o;
int col = int(random(0,100));
int xDim = int(random(0,30));
int yDim = int(random(0,30));
float dropswell = random(1,2);
boolean rising=true;
Drop(float x,float y) {
xpos = int (x);
ypos = int (y);
}
void drawdrop(){
if (col>=15){
pg.fill(0,0,255,255-o);}
else{
pg.fill(255,0,0,255-o);}
pg.noStroke();
pg.ellipse(xpos,ypos,xDim+i,xDim+i);
if((255-o)<80){
rising = false;}
if(rising){
i++; o++;}
if(!rising){
i=i-0.5; o++;}
}
boolean finished(){
if ((dist(mouseX,mouseY,xpos,ypos)<20)||((255-o)<0)){
return true;}
else{
return false;}}
}