flash on 2012-5-14
/**
* Copyright jokehn9 ( http://wonderfl.net/user/jokehn9 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/4UY1
*/
package {
import flash.display.Shape;
import flash.utils.Proxy;
import flash.events.MouseEvent;
import flash.filters.BevelFilter;
import flash.filters.BlurFilter;
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.filters.DisplacementMapFilter;
import flash.geom.Point;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var bd:BitmapData = new BitmapData(465, 465, false)
var bt:Bitmap = new Bitmap(bd);
bd.perlinNoise(465/2, 465/2, 5, Math.random()*0xFFFF, true, false)
var dmf:DisplacementMapFilter = new DisplacementMapFilter(bd, new Point, 1, 1)
var angle:Number = Math.random() * (Math.PI + Math.PI)
const magnitude:Number = 64
dmf.scaleX = magnitude * Math.cos(angle)
dmf.scaleY = magnitude * Math.sin(angle)
bd.applyFilter(bd, bd.rect, new Point, dmf)
angle = Math.random() * (Math.PI + Math.PI)
dmf.scaleX = magnitude * Math.cos(angle)
dmf.scaleY = magnitude * Math.sin(angle)
bd.applyFilter(bd, bd.rect, new Point, dmf)
addChild(bt);
var temp:BitmapData = new BitmapData(465,465,false);
stage.addEventListener(MouseEvent.CLICK,mc);
function mc(e:MouseEvent):void {
bt.x -= 232.5;
bt.y -= 232.5
bt.scaleX *= 1.1;
bt.scaleY *= 1.1;
bt.x += 232.5;
bt.y += 232.5
bt.alpha *= 0.9;
}
}
}
}