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 & HelpSyntax Questions › fade in .png documents / transparency
Page Index Toggle Pages: 1
fade in .png documents / transparency (Read 621 times)
fade in .png documents / transparency
Jul 13th, 2007, 12:05am
 
hi,

i want to fade in the .png documents
& i don't know how.



help a designstudent..... big thanks




________________________________________________________

PImage karteohne;
PImage karte;
PImage kartegelb;


PImage kreuz;

String k1;
String k2;

float bx;
float by;
int bs = 1266;
int bd = 623;
boolean bover = false;
boolean locked = false;
float bdifx = 0.0;
float bdify = 0.0;


void setup()
{
 size(640, 480);
 frameRate (30);
 karteohne = loadImage("kartenormal.png");
 kartegelb = loadImage("kartegelb.png");
 karte = loadImage("karteinfarbe1 Kopie.png");
 
 kreuz = loadImage("kreuzpfeil.png");
 
 
 bx = width/10.0;

 by = height/10.0;
imageMode(CORNER);
}

void draw()
{
background(0);


 
 // Test if the cursor is over the box
 if (mouseX > bx-bs && mouseX < bx+bs &&
     mouseY > by-bd && mouseY < by+bd) {
   bover = true;  
   if(!locked) {

   }
 } else {
 
 
 //  bover = false;
 }
 
 // Draw the box
   image (karteohne , bx, by, bs, bd);
 
 if (k1=="an") {
 image (karte , bx, by, bs, bd);
 }
 
  if (k2=="an") {

 image (kartegelb, bx, by, bs, bd);
 }
// rect(bx, by, bs, bs);
    fill (150);
 noStroke();
 rect (0, 450, 640, 30);
 fill (255);
 rect (20, 455, 20, 20);
 rect (50, 455, 20, 20);
 
           if (((k1 == "an") &&(checkMouseOverButton (0, 0, 640, 450)==1)) || ((k2 == "an") &&(checkMouseOverButton (0, 0, 640, 450)==1)))
 {
      cursor(CROSS);
    }else {
      cursor(ARROW);
    }
}


void mousePressed() {
 if(bover) {
   locked = true;

 } else {
   locked = false;
 }
 bdifx = mouseX-bx;
 bdify = mouseY-by;
 
    if (checkMouseOverButton (20, 455, 20, 20)==1){
k1 = "an";
k2 = "aus";}


   

     if (checkMouseOverButton (50, 455, 20, 20)==1){
k2 = "an";
k1 = "aus";}


}

void mouseDragged() {
 if(locked) {
   bx = mouseX-bdifx;
   by = mouseY-bdify;
 }
}


int checkMouseOverButton (int xpos, int ypos, int breite, int hoehe) {
 if ((mouseX>xpos) && (mouseX<xpos+breite) && (mouseY>ypos) && (mouseY<ypos+hoehe)) {
   return 1;
 }
 else {
   return 0;
 }
}
Re: fade in .png documents / transparency
Reply #1 - Jul 13th, 2007, 1:43pm
 
use the tint() command to control the transparency of images.
Page Index Toggle Pages: 1