Advertisement
Jnk1296

Sky Alpha Mask

Feb 10th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. package net.jnk.blockles;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5.  
  6. public class backdrop {
  7.    
  8.     public static double alpha;
  9.  
  10.     public void calculateAlpha(double currentY){
  11.         int yValue = (int)currentY;
  12.        
  13.         if (yValue < 20){
  14.             alpha = 0;
  15.         } else {
  16.             alpha = ((yValue - 19) * 2.55);
  17.         }
  18.        
  19.         if (alpha > 255){
  20.             alpha = 255;
  21.         }
  22.     }
  23.    
  24.     public void render(Graphics g){
  25.         g.setColor(new Color(66, 66, 66, (int)alpha));
  26.             g.fillRect(0, 0, Component.pixel.width, Component.pixel.height);
  27.     }
  28.    
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement