クリックしたらだんだん透明になるグラデーション。
♥0 |
Line 47 |
Modified 2009-08-18 11:58:29 |
MIT License
archived:2017-03-09 14:33:11
ActionScript3 source code
/**
* Copyright pykgg476 ( http://wonderfl.net/user/pykgg476 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2PAq
*/
package {
import flash.display.GradientType;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Matrix;
public class GrandientFill extends Sprite
{
static var colors:Array = new Array();
static var alphas:Array= new Array();
static var ratios:Array= new Array();
static var matrix:Matrix = new Matrix();
var my:Sprite = new Sprite();
public function GrandientFill()
{
init();
}
public function init():void{
my.graphics.lineStyle(1);
GrandientFill.colors = [0xfff000,0xff22a1];
GrandientFill.alphas= [1,1];
GrandientFill.ratios= [0,255];
GrandientFill.matrix.createGradientBox(100,100,87,100,100);
my.graphics.beginGradientFill(GradientType.LINEAR,colors,alphas,ratios,matrix);
my.graphics.drawRect(100,100,200,200);
my.graphics.endFill();
addChild(my);
stage.addEventListener(MouseEvent.CLICK,click);
}
public function click(event:MouseEvent):void{
if(alphas[1] != 0){
addEventListener(Event.ENTER_FRAME, onTimer);
}
}
public function onTimer(event:Event):void{
GrandientFill.alphas[1] -= 0.01;
my.graphics.clear();
my.graphics.lineStyle(1);
my.graphics.beginGradientFill(GradientType.LINEAR,colors,alphas,ratios,matrix);
my.graphics.drawRect(100,100,200,200);
my.graphics.endFill();
if(GrandientFill.alphas[1] <= 0){
removeEventListener(Event.ENTER_FRAME, onTimer);
}
}
}
}