Toggle navigation
Sign Up
Log In
Explore
Works
Folders
Tools
Collections
Artists
Groups
Groups
Topics
Tasks
Tasks
Jobs
Teams
Jobs
Recommendation
More Effects...
ActionScript
// forked from s8t1h12akj's forked from: forked from: エセVJ素材 package { import flash.filters.DisplacementMapFilter; import flash.geom.Matrix; import flash.text.TextField; import flash.filters.BlurFilter; import flash.geom.Point; import flash.geom.ColorTransform; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.BlendMode; import flash.events.MouseEvent; import flash.events.Event; import flash.display.Sprite; public class RandomTriangle extends Sprite { private const PARTICLE_NUM:Number = 10; private var container:Sprite; private var _particles :Array; private var counter:Number; private var canvas:BitmapData; private var fxbmd:BitmapData; private var cTrs:ColorTransform; private var bFlt:BlurFilter; private var dFlt:DisplacementMapFilter; private var mat:Matrix; // ノイズ関数の数 private var octaveCnt:Number = 3; // 乱数シード private var rndSeed:Number = Math.floor(Math.random() * 65535); // パーリンノイズのオフセット値の配列 private var offsetArray:Array = new Array(); // パーリンノイズの変化量の配列 private var speedArray:Array = new Array(); // 変化スピード private var speed:Number; // パーリンノイズ画像 private var perlinNoiseBitmap:BitmapData; public function RandomTriangle(){ _particles = []; container = new Sprite(); addChild(container); canvas = new BitmapData(stage.stageWidth, stage.stageHeight); addChild(new Bitmap(canvas)) as Bitmap; cTrs = new ColorTransform(1, 1, 1, .8); bFlt = new BlurFilter(4, 4, 1); mat = new Matrix(.8,0,0,.8,0,0); draw(PARTICLE_NUM); addEventListener(Event.ENTER_FRAME, _upDate); perlinNoiseBitmap = new BitmapData(canvas.width, canvas.height); // 関数の数だけ必要 for (var i:Number = 0; i < octaveCnt; i++) { offsetArray[i] = new Point(0, 0); // 乱数で変化する向きを決定 speedArray[i] = new Point(speed * (Math.floor(Math.random() * 2) == 0 ? -1 : 1), speed * (Math.floor(Math.random() * 2) == 0 ? -1 : 1)); } // パーリンノイズ画像生成 perlinNoiseBitmap.perlinNoise( canvas.width, canvas.height, octaveCnt, rndSeed, false, true, 1, false, offsetArray ); // 歪みフィルターを作成 dFlt = new DisplacementMapFilter( perlinNoiseBitmap, new Point(0, 0), 1, 1, -20, 20 ); } private function draw(num:Number):void{ for(var i:int=0; i
death) kill(); //Delayをめちゃくちゃにする t.delay = Math.random() * 80; } private function _upDate(e:Event):void{ draw(); //ぐるんぐるん回す } private function kill():void{ t.removeEventListener(TimerEvent.TIMER, _upDate); sc.removeEventListener(Event.ENTER_FRAME, _timerSet); t.stop(); sc.removeChild(s); removeChild(sc); deadFlag = true; } public function get getDeadFlag():Boolean{ return deadFlag; } }
Join Effecthub.com
Working with Global Gaming Artists and Developers!
Login
Sign Up
Or Login with Your Email Address:
Email
Password
Remember
Or Sign Up with Your Email Address:
Your Email
This field must contain a valid email
Set Password
Password should be at least 1 character
Stay informed via email