forked from: Your mouse is a source of light.. a drop on the water.. the only you! (entah13)
forked from Your mouse is a source of light.. a drop on the water.. the only you! (entah13) (diff: 1)
20090525 Just-for-fun! Move your mouse around, SLOWLY and see the pattern, Quickly and see the pattern. Gerakin tikusmu PELAN-PELAN dan liat polanya, Cepat2 dan liat polanya. マウスを動かしてみて。 ユックリとなにかパターンが見える。 急いでるとなにかパターンが見える。
ActionScript3 source code
/**
* Copyright fukt ( http://wonderfl.net/user/fukt )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/n5U5
*/
// forked from yuku's Your mouse is a source of light.. a drop on the water.. the only you! (entah13)
// 20090525 Just-for-fun!
// Move your mouse around, SLOWLY and see the pattern,
// Quickly and see the pattern.
// Gerakin tikusmu PELAN-PELAN dan liat polanya,
// Cepat2 dan liat polanya.
// マウスを動かしてみて。 ユックリとなにかパターンが見える。
// 急いでるとなにかパターンが見える。
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.text.TextField;
[SWF(width=400, height=400, backgroundColor=0x000000, frameRate=30)]
public class entah13 extends Sprite
{
var bm: Bitmap;
var b: BitmapData;
var c: BitmapData;
var cmx: Number, cmy: Number;
var tinta: uint = 0xffffffff;
var kosong: uint = 0x00000000;
var petunjuk: TextField;
public function entah13()
{
this.scaleX = this.scaleY = 2;
b = new BitmapData(200, 200, false, 0x000000);
c = b.clone();
bm = new Bitmap(b);
addChild(bm);
petunjuk = new TextField();
petunjuk.border = true;
petunjuk.textColor = 0xffffff;
petunjuk.selectable = false;
petunjuk.autoSize = 'left';
petunjuk.text = "mouse, come come move move here!~";
addChild(petunjuk);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
stage.addEventListener(Event.ENTER_FRAME, enterFrame);
}
function enterFrame(e) {
if (! isNaN(cmx)) {
petunjuk.visible = false;
b.lock();
b.setPixel32(cmx, cmy, tinta);
apdet(b, cmx, cmy);
b.unlock();
}
}
function mouseMove(e: MouseEvent) {
cmx = stage.mouseX/2;
cmy = stage.mouseY/2;
}
function apdet(b: BitmapData, mx, my) {
var w: int = b.width;
var h: int = b.height;
for (var cx: int = 0; cx < w; ++cx) for (var cy: int = 0; cy < h; ++cy) {
var a: Number = Math.atan2(my - cy, mx - cx);
var sx: Number = cx + Math.cos(a);
var sy: Number = cy + Math.sin(a);
c.setPixel32(cx, cy, b.getPixel32(Math.round(sx), Math.round(sy)));
}
b.copyPixels(c, c.rect, new Point());
var r: Rectangle = b.getColorBoundsRect(0xffffff, tinta);
if (r.width == w && r.height == h) {
tinta = kosong;
kosong = (kosong == 0)? 0xffffffff: 0x00000000;
}
}
}
}