Line Wave Saqoosha forked:5 favorite:12 lines:59 license : MIT License modified : 2009-01-13 19:51:14 // write as3 code here.. package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Graphics; import flash.display.Shape; import flash.display.Sprite; import flash.display.StageQuality; import flash.events.Event; import flash.geom.Point; [SWF(width=465, height=465, backgroundColor=0x0, frameRate=60)] public class Wave extends Sprite { private static const ZERO_POINT:Point = new Point(); private static const SCROLL_SPEED:Number = 1.2; private static const NOISE_BASE_X:Number = 150; private static const NOISE_BASE_Y:Number = 50; private static const WAVE_HEIGHT:Number = 40; private static const LINE_STEP_X:int = 16; private static const LINE_STEP_Y:int = 4; private var _noise:BitmapData; private var _wave:Shape; private var _scroll:Point = new Point(); public function Wave() { this.addEventListener(Event.ADDED_TO_STAGE, this._onAddedToStage); } private function _onAddedToStage(e:Event):void { this.stage.quality = StageQuality.LOW; this._noise = new BitmapData(this.stage.stageWidth, this.stage.stageHeight, false, 0x0); this._wave = this.addChild(new Shape()) as Shape; this.addEventListener(Event.ENTER_FRAME, this._update); } private function _update(e:Event):void { this._scroll.x += SCROLL_SPEED; this._scroll.y += SCROLL_SPEED; this._noise.perlinNoise(NOISE_BASE_X, NOISE_BASE_Y, 2, 123456, true, true, 1, true, [this._scroll]); var g:Graphics = this._wave.graphics; g.clear(); g.lineStyle(1, 0xffffff, 0.5); var px:Number = 0; var py:Number = 0; g.moveTo(px, py); while (1) { var ly:Number = py + ((this._noise.getPixel(px, py) & 0xff) / 0x80 - 1) * WAVE_HEIGHT; if (px == 0) { g.moveTo(px, ly); } else { g.lineTo(px, ly); } px += LINE_STEP_X; if (px >= this._noise.width) { px = 0; py += LINE_STEP_Y; if (py >= this._noise.height) { break; } } } } } } Code Fullscreen Preview Fullscreen necoEngine hiro_rec imajuk FlashFit muroicci fallen cyberryo atsumo uhura : 2D-Wave takaki8 : BitmapData effect graphics 線のぐねぐねで波を表現 northprint : なみなみ ton : 波! 2D-Wave BitmapData effect graphics StageQuality.LOW Event.ADDED_TO_STAGE Point Event.ENTER_FRAME Event int Number sort new page view favorite forked pv 288 forked from: Line Wave tombor83 forked:0 favorite:0 lines:59 ( diff:1 ) pv 728 forked from: Line Wave hacker_qus3vzf3 forked:2 favorite:0 lines:59 ( diff:1 ) pv 374 forked from: Line Wave lehurament forked:0 favorite:0 lines:59 ( diff:1 ) pv 2549 forked from: Line Wave makc3d forked:3 favorite:14 lines:63 ( diff:77 ) tag: BLUE WAVES bitmapdata motion wave pv 982 forked from: Line Wave hacker_g2scu8pr forked:1 favorite:1 lines:59 ( diff:1 )