flash on 2010-1-25
♥0 |
Line 37 |
Modified 2010-01-25 13:40:30 |
MIT License
archived:2017-03-20 01:45:36
ActionScript3 source code
/**
* Copyright nausicaa ( http://wonderfl.net/user/nausicaa )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/6cxA
*/
package {
import flash.display.Sprite;
import frocessing.core.F5Graphics2D;
[SWF(width=465, height=465, backgroundColor=0)]
public class FlashTest extends Sprite {
private var fg:F5Graphics2D;
public function FlashTest() {
//var fg:F5Graphics2D = new F5Graphics2D(graphics);
fg = new F5Graphics2D(graphics);
fg.strokeCap("none");
fg.colorMode("hsv", 465, 1, 465);
for(var i:int=0; i < 400; i++){
var cx:Number = Math.random()*465;
var cy:Number = Math.random()*465;
if(Math.random() > 0.5){
fg.noStroke();
fg.fill(cx, 1, cy, 0.25);
}else{
fg.noFill();
fg.strokeWeight(Math.random()*4);
fg.stroke(cx, 1, cy);
}
//位置と回転と大きさを指定して描画
fg.pushMatrix(); //変形状態を保存
fg.translate(cx, cy); //移動
fg.rotate(Math.random()*2*Math.PI);
fg.scale(Math.random()*20); //拡大縮小
drawFig();
fg.popMatrix(); //直前に保存した変形状態に復帰
}
}
private function drawFig():void{
fg.circle(0, 0, 0.6); //円 circle(centerX, centerY, width, Radian)
fg.arc(0, 0, 2.0, 2.0, 0.5, 2*Math.PI-0.5); //円弧 arc(centerX, centerY, width, height, beginRadian, endRadian)
fg.moveTo(-0.6, 0);
fg.bezierTo(-0.15, 0.6, 0.15, -0.6, 0.6, 0); //3次ベジェ曲線 bezierTo(cx1, cy1, cx2, cy2, x, y)
}
}
}