frocessingの練習2
frocessingの練習です。
♥0 |
Line 63 |
Modified 2012-06-25 21:40:31 |
MIT License
archived:2017-03-20 07:47:30
ActionScript3 source code
/**
* Copyright yuugurenote ( http://wonderfl.net/user/yuugurenote )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/b5sD
*/
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.Graphics;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.ColorTransform;
import frocessing.color.ColorHSV;
[SWF(width=465,height=465,backgroundColor=0xFFFFFF,frameRate=60)]
public class AS120625_03 extends Sprite {
public var sw:Number=stage.stageWidth;
public var sh:Number=stage.stageHeight;
public var myCol:int=0;
public var myColor:ColorTransform = new ColorTransform();
public var viewBmd:BitmapData=new BitmapData(sh,sw,false,0x000000);
public var viewBmp:Bitmap=new Bitmap(viewBmd);
public var _myRect:myRect;
public var _myArray:Array = new Array();
public function AS120625_03() {
addChild(viewBmp);
var tmpBmd:BitmapData;
myColor.redMultiplier=0.99;
myColor.greenMultiplier=0.99;
myColor.blueMultiplier=0.99;
addEventListener(Event.ENTER_FRAME,xDraw);
//stage.addEventListener(MouseEvent.MOUSE_MOVE,xDown);
addEventListener(Event.ENTER_FRAME,xDown);
}
public function xDraw(e:Event):void {
viewBmd.draw(stage,null,myColor);
}
public function xDown(e:Event):void {
var _color:ColorHSV=new ColorHSV(myCol+=1,0.9);
_myRect=new myRect(int(_color));
_myRect.x=mouseX;
_myRect.y=mouseY;
addChild(_myRect);
}
}
}
import flash.display.Sprite;
import flash.filters.BlurFilter;
import flash.events.Event;
import frocessing.color.ColorHSV;
class myRect extends Sprite {
public var deg:Number=0;
public var radius:Number=0.5;
//public var myFil:BlurFilter=new BlurFilter(2,2,2);
public function myRect(color:uint) {
this.graphics.beginFill(int(color),1);
this.graphics.drawRect(0,0,radius,radius+0.5);
this.graphics.endFill();
//this.filters=[myFil];
this.addEventListener(Event.ENTER_FRAME,xEnter2);
}
public function xEnter2(e:Event):void {
deg = (deg+3)%360;
this.y+=1;
this.x=this.x-5*Math.cos(deg*Math.PI/180);
if (this.y>stage.stageHeight) {
this.graphics.clear();
this.removeEventListener(Event.ENTER_FRAME,xEnter2);
}
}
}