forked from: colin challenge for amateurs
forked from colin challenge for amateurs (diff: 55)
Draw a Tasty Ramen ! * * You can edit and modify every piece of this code. * Load more pictures of GU (ingredients of ramen) * from flickr or draw one by yourself. * Make it look tasty. * * ~Okay, a noodle, not sure if it's tasty tho...
ActionScript3 source code
/**
* Copyright pipeep ( http://wonderfl.net/user/pipeep )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/hG28
*/
// forked from checkmate's colin challenge for amateurs
/*
*
* Draw a Tasty Ramen !
*
* You can edit and modify every piece of this code.
* Load more pictures of GU (ingredients of ramen)
* from flickr or draw one by yourself.
* Make it look tasty.
*
* ~Okay, a noodle, not sure if it's tasty tho...
*/
package{
import flash.display.Sprite;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
import __AS3__.vec.Vector;
import flash.geom.Point;
[SWF(width="460", height="460", backgroundColor="0xFFFFFF", frameRate="30")]
public class FlashTest extends Sprite {
public var particles:Vector.<Particle>;
public var maxDist:Number;
public var minDist:Number;
public function FlashTest(a_minDist:Number = 3, a_maxDist:Number = 10, a_width:Number = 20.):void {
for(var i:int = 0; i < 10; ++i) {
particles.push(new Particle(new Point(i*a_maxDist, 0), new Point(i*a_maxDist, a_width)));
}
step();
}
private function step(event:Event = null):void {
var triangleVect:Vector.<Number> = new Vector.<Number>();
for(var i:int = 1; i < particles.length; ++i) {
//particles[i].offset(0, 5);
triangleVect.push(particles[i].point1);
triangleVect.push(particles[i].point2);
triangleVect.push(particles[i-1].point1);
triangleVect.push(particles[i-1].point1);
triangleVect.push(particles[i-1].point2);
triangleVect.push(particles[i].point2);
}
graphics.beginFill(0xFF000000);
graphics.drawTriangles(triangleVect);
graphics.endFill();
}
}
}
import flash.geom.Point;
class Particle {
public var point1:Point;
public var point2:Point;
public var width:Number;
public function Particle(a_p1:Point, a_p2:Point):void {
point1 = a_p1;
point2 = a_p2;
width = Point.distance(point1, point2);
}
}