forked from: forked from: forked from: forked from: forked from: flash on 2011-1-18
109 -> 90 -> 85 -> 80 -> 78 -> ~1500 (click to color-cycle)
/**
* Copyright yonatan ( http://wonderfl.net/user/yonatan )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/7FNw
*/
// forked from 9re's forked from: forked from: forked from: forked from: flash on 2011-1-18
// forked from 12346's forked from: forked from: forked from: flash on 2011-1-18
// forked from matacat's forked from: forked from: flash on 2011-1-18
// forked from 9re's forked from: flash on 2011-1-18
// forked from bkzen's flash on 2011-1-18
// 109 -> 90 -> 85 -> 80 -> 78 -> ~1500
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import caurina.transitions.Tweener;
[SWF (backgroundColor = "0xFFFFFF", width = "255", height = "255", frameRate = "60")]
public class FlashTest extends Sprite {
private var bmp:Bitmap;
private var bmd:BitmapData;
private var xforms:Array;
private var cxforms:Array;
public function FlashTest() {
//for(;x<(y=255)*y;x++)graphics.beginFill((z=y-(x%y|x/y)%y)<<16|z<<8|z),graphics.drawRect(x%y,x/y,1,1);x=y=z=0;
//with(graphics)for(c=255,y=c;y--;)for(x=c;x--;)beginFill(~(x|y)%c*65793),drawRect(x,y,1,1);
//with(graphics)for(y=c=255;y--;)for(x=c;x--;)beginFill(0,(x|y)%c/c),drawRect(x,y,1,1);
//with(graphics)for(y=c=255;x||y--;drawRect(x=x%c,y,1,1))beginFill(0,(++x|y)%c/c);
//with(graphics)for(y=c=255;x||y--;drawRect(x%=c,y,1,1))beginFill(0,(++x|y)%c/c)
bmd = new BitmapData(0x100,0x100,false);
bmp = new Bitmap(bmd);
addChild(bmp);
xforms = [new Matrix(0.5, 0, 0, 0.5, 0, 0),
new Matrix(0.5, 0, 0, 0.5, 0x80, 0),
new Matrix(0.5, 0, 0, 0.5, 0, 0x80),
new Matrix(0.5, 0, 0, 0.5, 0x80, 0x80)];
cxforms = [new ColorTransform(0.5, 0.5, 0.5, 1, 0x80, 0x80, 0x80, 0),
new ColorTransform(0.5, 0.5, 0.5, 1, 0, 0, 0, 0),
new ColorTransform(0.5, 0.5, 0.5, 1, 0, 0, 0, 0),
new ColorTransform(0.5, 0.5, 0.5, 1, 0, 0, 0, 0)];
addEventListener("enterFrame", frame);
stage.addEventListener("click", click);
}
private function frame(e:Event):void {
bmd.lock();
for(var i:int = 0; i < 4; i++) {
bmd.draw(bmp, xforms[i], cxforms[i]);
}
bmd.unlock();
}
private function click(e:Event):void {
stage.removeEventListener("click", click);
tween();
}
private function tween():void {
for(var i:int = 0; i < 4; i++) {
Tweener.addTween(cxforms[i], {
redMultiplier: Math.random()*2-1,
greenMultiplier: Math.random()*2-1,
blueMultiplier: Math.random()*2-1,
redOffset: 0x80,
greenOffset: 0x80,
blueOffset: 0x80,
time: 1.5,
transition: "easeInOutSine",
onComplete: i ? null : tween});
}
}
}
}