无聊的ColorTransform

类别:软件工程 点击:0 评论:0 推荐:

 

class com.flashvan.drawing.ColorTransform { private var _color:Color; private var _target:MovieClip; public var ra,rb,ga,gb,ba,bb,aa,ab:Number; function ColorTransform(transform:Array,target:MovieClip) { _target = target; _color = new Color(_target); ra = transform[0]; rb = transform[1]; ga = transform[2]; gb = transform[3]; ba = transform[4]; bb = transform[5]; aa = transform[6]; ab = transform[7]; }; public function run():Void { if(_target!= null) _color.setTransform(this); } public function reset():Void { Transform = [100,0,100,0,100,0,100,0]; _color.setTransform(this); } public function get Target():MovieClip { return _target; } public function set Target(value:MovieClip):Void { _target = value; _color = new Color(_target); } public function set Transform(transform:Array):Void { ra = transform[0]; rb = transform[1]; ga = transform[2]; gb = transform[3]; ba = transform[4]; bb = transform[5]; aa = transform[6]; ab = transform[7]; } public function get Transform():Array { return [ra,rb,ga,gb,ba,bb,aa,ab]; } };

做效果用, 封装了一下, 省得麻烦 :D 另外还有一个ColorConverter.主要是RGBToHSB和HSBToRGB

用法:

 

import com.flashvan.drawing.ColorTransform; var ct:ColorTransform = new ColorTransform([100, 244, 100, 0,100, 0,100, 0],mc); ct.run(); pre {font-family:"Courier New", Courier, Arial; font-size: 12px;} .operator {color: #000000;} .keyword {color: #993300;} .identifier {color: #000087;} .properties {color: #000087;} .identifier2 {color : #000087;} .linecomment, .blockcomment {color: #808080;} .string {color: #0000FF;}

本文地址:http://com.8s8s.com/it/it34558.htm