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

forked from: forked from: Peak beta 1

package com.myx.pnp
[SWF(width=465, height=465, frameRate=24, backgroundColor=0x000000)]

//package com.myx.pnp

package
{
  import flash.display.*;
  import flash.events.*;
  import flash.filters.*;
  import flash.geom.*;
  import flash.text.*;
  import flash.utils.*;
  
  //[SWF(width=465, height=465, frameRate=24, backgroundColor=0x000000)]

  public class Peak extends Sprite 
  {
    private var heightMap:BitmapData = new BitmapData(200,200,false,0);
    private var temp:BitmapData = new BitmapData(200,200,true,0);
    private var pos: Bitmap = new Bitmap(heightMap);
    public var Tbl:Array = new Array;

    public function Peak() 
    {
        this.rotationX = -78;
        this.y = this.y+200;
        this.scaleX = 1.5;
                 
        
        stage.addEventListener(Event.ENTER_FRAME , generate); 
            
        Tbl[0] = new Point;
        Tbl[0].x = 1.0;
        Tbl[0].y = 1.0;

        pos.scaleX = 2.0;
        pos.scaleY = 2.0;
        addChild(pos);
    }

    public function generate(event: Event): void {
      Tbl[0].x += 2.0;
      Tbl[0].y += 1.5;
      heightMap.perlinNoise(50,50,2,0,true,true, 4, false, Tbl);
      
      // solarize:
      var palette: Array = new Array(256);
      var threshold: int = 100;
      var val:int;
      for (var i:int = 0; i < 128; i++) {
        if (i < threshold) val = 0; else val = (i - threshold) * 255 / (127 - threshold);
        val = (val << 16) | (val << 8) | (val << 0);
          palette[i] = val;
          palette[255 - i] = val;
      }
      heightMap.paletteMap(heightMap, new Rectangle(0,0,heightMap.width,heightMap.height), new Point(0,0), null, null, palette, null);
      
    }
  }
}