In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

DisplacementMapFilterとTweener

Get Adobe Flash player
by kuma360 15 Jul 2010
/**
 * Copyright kuma360 ( http://wonderfl.net/user/kuma360 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/fuJz
 */

// forked from kuma360's flash on 2010-7-15
package {
    import flash.display.* ;
    import flash.filters.DisplacementMapFilter;
    import caurina.transitions.Tweener;
    import caurina.transitions.properties.FilterShortcuts;
    import flash.events.Event;
    
    public class Main extends Sprite {
        
        public function Main() {
            
            FilterShortcuts.init ( ) ;
            
            this.x = 200 ;
            this.y = 200 ;
            
            var G:Graphics = this.graphics;
            G.beginGradientFill( "radial" , [ 0xF02020 , 0x000000 ] , [ 0 , 1 ] , [ 0 , 255 ] ) ;
            G.drawRect ( -200 , -200 , 465 , 465 ) ;
            G.endFill ( ) ;
            
            var BD:BitmapData = new BitmapData( 465 , 465 , false , 0 ) ;
            BD.perlinNoise ( 60 , 60 , 2 , 0 , true , false ) ;
            
            var D:DisplacementMapFilter = new DisplacementMapFilter ( BD , null , 2 , 1 , 100 , 100 , "wrap" , 0 , 1 ) ;
            this.filters = [D];
            
            run ( ) ;
            
        }
        
        public function run():void 
        {
            Tweener.addTween (
                this , 
                { 
                    _DisplacementMap_mapPoint_x:-Math.random()*100, 
                    _DisplacementMap_mapPoint_y:-Math.random()*100, 
                    _DisplacementMap_scaleX: Math.random() < 0.5 ? ( Math.random()*100 + 50 ) : - ( Math.random()*100 + 50 )  , 
                    _DisplacementMap_scaleY: Math.random() < 0.5 ? ( Math.random()*100 + 50 ) : - ( Math.random()*100 + 50 )  , 
                    time:1,
                    onComplete:run
                }
            )
        }
        
    }
    
}