flash on 2009-10-1
22.02.2010
code inspired by http://wonderfl.net/code/45649233f29c39112166bbab3405becff46b86d4
/**
* Copyright _hacke ( http://wonderfl.net/user/_hacke )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/9Qai
*/
// 22.02.2010
//code inspired by http://wonderfl.net/code/45649233f29c39112166bbab3405becff46b86d4
package {
import flash.display.Sprite;
import flash.display.LineScaleMode;
import flash.display.CapsStyle;
import flash.display.JointStyle;
import flash.display.Shape;
public class Graphics_lineToExample extends Sprite {
public function Graphics_lineToExample() {
var spiked:Shape = new Shape();
var r:Number;
var ri:Number;
var ra:Number;
var phi:Number;
var spikes:uint;
var x:Number;
var y:Number;
var step:uint;
var upordown:Number; //dirty cheat
//curve, curveOffset;
ri = 150; ra = 210; r = ri; phi = 0;
spiked.graphics.lineStyle(1, 0x40D700, 100, false, LineScaleMode.NONE,
CapsStyle.NONE, JointStyle.MITER, 10);
spiked.graphics.moveTo(230+r, 230);
spikes = 6; //feasible value<300
step = (ra-ri)*spikes/180;
while(phi<=360)
{
if( r >= ra )
upordown = -step;
else if( r <= ri )
upordown = step;
r+=upordown;
x= r * Math.cos( phi * Math.PI / 180 );
y= r * Math.sin( phi * Math.PI / 180 );
spiked.graphics.lineTo(230+x,230+y);
phi+=1;
}
this.addChild(spiked);
}
}
}