Advertisement
netgrind

Circle Line Colors Source

Jun 23rd, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package {
  2.     import flash.display.Bitmap;
  3.     import flash.display.BitmapData;
  4.     import flash.display.Sprite;
  5.     import flash.events.Event;
  6.     import flash.geom.ColorTransform;
  7.    
  8.     /**
  9.      * @author netgrind
  10.      * PRETTY COLORS
  11.      * USE FOR WHATEVER AT OWN RISK
  12.      * Example swf http://netgrindgames.com/trips/CircleFunLines.swf
  13.      */
  14.     public class CircleLines extends Sprite {
  15.        
  16.         public var w:int = 1000;//width of swf
  17.         public var h:int = 600;//height of swf (weird fucking ratio...)
  18.         public var large:int = 300;//outer circle radius
  19.         public var small:int = 60;//inner circle radius
  20.         public var bd:BitmapData;//for drawing the graphics to, keep the shape count low.
  21.         public var s:Sprite;//for drawing on
  22.         public var o:int = 0;//frame counter
  23.         public var deg:int = 60;//degrees inner circle is shifted
  24.        
  25.         public function CircleLines() {
  26.             super();
  27.             bd = new BitmapData(w, h, true, 0);
  28.             addChild(new Bitmap(bd,'never',true));
  29.             s = new Sprite();
  30.             addEventListener(Event.ENTER_FRAME, update);
  31.         }
  32.         public function update(e:Event):void {
  33.             deg = (mouseX - w * .5) * .5;
  34.             small = mouseY;
  35.             o += 2
  36.             for (var i:Number = 0; i < 360; i+=5) {
  37.                 s.graphics.lineStyle(1,UtilsArt.HSBtoHEX(i+o,75,75));
  38.                 s.graphics.moveTo(Math.sin(i*Math.PI/180)*large+w*.5, Math.cos(i*Math.PI/180)*large+h*.5);
  39.                 s.graphics.lineTo(Math.sin((i+deg)*Math.PI/180) * small*.5 + w * .5, Math.cos((i+deg)*Math.PI/180) * small*.5 + h * .5);
  40.             }
  41.             bd.draw(s);
  42.             bd.colorTransform(bd.rect, new ColorTransform(1, 1, 1, .9));
  43.             s.graphics.clear();
  44.         }
  45.     }  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement