Public Group

# Alpha value?

This topic is 4876 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

What exactly is an alpha value, and what is it for? Is it really important?

##### Share on other sites
Alpha is important if you want to work with transparency. As always, Wikipedia to the rescue.

##### Share on other sites
Alpha [in graphical use] is a measure of opaqueness.

Yes, it's fairly important to understand, if not so important to actually use.

##### Share on other sites
I see. Thanks. ^_^

##### Share on other sites
Bear in mind that while the alpha value has historically meant 'opacity,' it's frequently abused into meaning other things - like reflectivity or brightness. At the end of the day it's just a number, and if you feed it to the parts of the system that deal with reflectivity or brightness instead of the parts of the system that deal with opacity, nothing will go "Hey, what? That's an alpha value dude, get it away from me."

##### Share on other sites
Here is some java applet I did a while ago that uses it, so you can see it in action if you want to compile it etc.

import javax.swing.*;
import java.awt.*;

public class BallApplet extends JApplet{
Color array[] = new Color[20];

public BouncingBallApplet(){
for(int x=0; x < b.length; ++x){
array[x] = new Color((int)(Math.random()*250),(int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255));
b[x] = new BallThread((int)(Math.random()*800),(int)(Math.random()*60));
b[x].start();
}
this.setSize(800,600);

}

public void paint(Graphics g){
g.setColor(array[(int)(Math.random()*array.length)]);
g.fillOval(b[(int)(Math.random()*20)].xLoc,b[(int)(Math.random()*20)].yLoc,40,40);
this.repaint(40);
}

public static void main(String args[]){
new BallApplet();
}

private int xLoc;
private int yLoc;

public BallThread(int x, int y){
xLoc = x;
yLoc = y;
}

public void run(){
for(;;){
xLoc = (int)(Math.random()*800);
yLoc = (int)(Math.random()*600);

try{
this.sleep((long)(Math.random()*200));
}catch(InterruptedException e){
System.out.println(e.toString());
}

}
}
}
}

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 14
• 14
• 10
• 9
• 11
• ### Forum Statistics

• Total Topics
634096
• Total Posts
3015492
×