flash on 2011-10-19
from http://www.project-nya.jp/modules/weblog/details.php?blog_id=1076
♥0 |
Line 36 |
Modified 2011-10-19 17:53:00 |
MIT License
archived:2017-03-20 19:44:54
ActionScript3 source code
/**
* Copyright y_tama ( http://wonderfl.net/user/y_tama )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/4A7f
*/
package {
//from http://www.project-nya.jp/modules/weblog/details.php?blog_id=1076
import frocessing.display.F5MovieClip2DBmp;
[SWF(backgroundColor="#FFFFFF", width="400", height="320", frameRate="30")]
public class Main extends F5MovieClip2DBmp {
// プロパティ
private static var bWidth:uint = 400;
private static var bHeight:uint = 300;
private static var points:uint = 10;
private static var ratio:Number = 1/points;
private static var colors:uint = 360;
private var t:Number = 0;
private var xOffset:Number = 0.25;
private var yOffset:Number = 0.01;
// コンストラクタ
public function Main() {
super();
}
// メソッド
public function setup():void {
size(bWidth, bHeight);
background(255);
noFill();
}
public function draw():void {
translate(0, bHeight*0.5 + 20);
stroke(0, 0.1);
beginShape();
curveVertex(-bWidth*ratio, 0);
for (var n:uint = 1; n <= points+1; n++) {
var xPos:Number = n*bWidth*ratio;
var yPos:Number = noise(n*xOffset, t)*bHeight - bHeight*0.5;
curveVertex(xPos-bWidth*ratio, yPos);
}
curveVertex(bWidth*(1+ratio), 0);
endShape();
t += yOffset;
}
}
}