Jump to content
  • Advertisement
Sign in to follow this  
Twisol

Alpha value?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Alpha [in graphical use] is a measure of opaqueness.

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

Share this post


Link to post
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 this post


Link to post
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{
BallThread b[] = new BallThread[20];
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();
}

public class BallThread extends Thread{
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());
}

}
}
}
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!