三角波(塗りなし)

by lenonsun forked from 折れ線を描く (diff: 40)
♥0 | Line 34 | Modified 2011-10-30 22:41:34 | MIT License
play

ActionScript3 source code

/**
 * Copyright lenonsun ( http://wonderfl.net/user/lenonsun )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ibvq
 */

// 三角波(塗りなし)
package 
{
    import frocessing.display.F5MovieClip2D;
    /**
     * 三角波(塗りなし)
     */
    public class GraphicExample extends F5MovieClip2D
    {
        public function setup() : void
        {
            background(128);
            drawGridGuide();
            noFill();
            strokeWeight(2);
            beginShape();
            vertex(100,250);
            vertex(150,200);
            vertex(200,250);
            vertex(250,200);
            vertex(300,250);
            vertex(350,200);
            vertex(400,250);
            endShape();
       }
        // 以下は,位置をわかり安くする説明のため
        // 処理なので無視してください.
        public function drawGridGuide() : void
        {
            var x : int;
            var y : int;
            stroke(192,192,192);
            for( x = 0 ; x < 465 ; x += 50 ) 
                line( x, 0, x, 465);
            for( y = 0 ; y < 465 ; y += 50 ) 
                line( 0, y, 465, y);
            stroke(0,0,0);            
        }
    }
}