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

25 line Heart

...
@author lizhi
Get Adobe Flash player
by lizhi 23 Nov 2012
    Embed
/**
 * Copyright lizhi ( http://wonderfl.net/user/lizhi )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/mMOt
 */

package  
{
	import flash.display.Sprite;
import flash.display.GradientType;
import flash.geom.Matrix;
import flash.events.Event;
	/**
	 * ...
	 * @author lizhi http://game-develop.net/
	 */
	[SWF(width=465,height=465,backgroundColor=0xffffff,frameRate=60)]
	public class Heart extends Sprite
	{

		public function Heart() 
		{
			//pow((x*x+y*y-1),3)+x*x*y*y*y==0
			
			var time:int=0;
this.addEventListener(Event.ENTER_FRAME,function():void{time++;
var w:int = (Math.sin(time/10)+1)/2*232+232, h:int = (Math.sin(time/13)+1)/2*232+232,upposs:Array = [],downposs:Array = [];
for (var i:int = 0; i < w; i++ ) {
        var lastplus:Number = 0;
        for (var j:int=0; j < h; j++ ) {
                var x_:Number = i * 3 / w - 1.5,y_:Number = j * 3 / h - 1.5,t:Number = x_ * x_ + y_ * y_ - 1,plus:Number = t * t * t + x_ * x_ * y_ * y_ * y_;
                if (lastplus * plus < 0) {
                        upposs[i] = upposs[i] > j?upposs[i]:j;
                        downposs[i] = downposs[i] == null?j:(downposs[i] < j?downposs[i]:j);
                }
                lastplus = plus;
        }
}
graphics.clear();
graphics.beginFill(0xff0000);
var matr:Matrix=new Matrix;
matr.createGradientBox(w,h,0,232-w/2,232-h/2);
graphics.beginGradientFill(GradientType.RADIAL,[0xff0000,0],[1,1],[0,0xff],matr);
var first:Boolean = true;
for(var istr:String in upposs) {
        if (first) graphics.moveTo(int(istr)+232-w/2, upposs[istr]+232-h/2);else graphics.lineTo(int(istr)+232-w/2, upposs[istr]+232-h/2);
        first = false;
}
var dxs:Array = [];
for (istr in downposs) dxs.push(int(istr));
dxs = dxs.reverse();
for each(i in dxs) graphics.lineTo(i+232-w/2, downposs[i]+232-h/2);graphics.endFill();  });		}
		
	}

}