We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › saving png transparency (post edit will do)
Page Index Toggle Pages: 1
saving png transparency (post edit will do) (Read 569 times)
saving png transparency (post edit will do)
Oct 25th, 2006, 1:36am
 
I'm working on a Flash presentation portfolio. So far I have a blue bubble theme going on.

Progress so far.

I used the following code to get those square bubbles on the left which I'm going to do for the bottom as well.
Code:

int squar = #0033FF;
int back = #99CCFF;
boolean left = true;
void setup(){
size(200, 600);
smooth();
background(back);
fill(squar);
noStroke();
if(left){
rect(0, 0, 20, height);
}else{
rect(width - 20, 0, 20, height);
}
rectMode(CENTER);
}
void draw(){
float x = random(width);
float y = random(height);
float xpos = x;
fill(lerpColor(back, squar, (1.0 / width) * x));
if(left){
xpos = width - x;
}
if(mousePressed){
rect(xpos, y, x / 10, x / 10);
}
}
void keyPressed(){
save("blok.tiff");
}

But I want to frame the MenuBar and TextArea with the same effect (hence those drifting bubbles).

Flash secretly has the ability to import .pngs with transparency (I guessed this because it comes bundled with FireworksMX, and I was right).

Now is there some hack I can do doing the pngs with, should I dig out the dreaded AIExport or perhaps use some other package

I'm a bit tired at the moment from learning undocumented Flash tweening classes all day so I'm not sure what to do.
Re: saving png transparency (post edit will do)
Reply #1 - Oct 29th, 2006, 3:11pm
 
Never mind. I just opted for the dreaded AIExport.
Code:

AIExport ai;
int back = #99CCFF;
void setup(){
size(800, 50, P3D);
background(back);
ai = new AIExport(this, 1);
ai.ai_rectMode(CENTER);
ai.ai_noStroke();
ai.turnTransparencyOn();
ai.setFileName("blok.ai");
ai.toggleContinuousRecording();
}
void draw(){
ai.run();
float x = random(width);
float y = random(height);
float squarSize = 20;
float transparency = 255;
squarSize *= (1.0 / height) * (height - y);
transparency *= (1.0 / height) * (height - y);
ai.ai_fill(0, 0, 204, transparency);
ai.ai_rect(x, y, squarSize, squarSize);
}
void keyPressed(){
ai.toggleContinuousRecording();
}
Page Index Toggle Pages: 1