docs/demos/js/pixel-heart.js
function PixelWalker(firstPoint, pixel_path) {

    // go clockwise starting first point
    var points = [];
    points.push(firstPoint);

    var moveHorizontal = true;	// alternate horizontal and vertical movements to form pixel heart

    pixel_path.forEach(function (p) {

        var previous_point = points[points.length - 1];
        var point_to_add;

        if (moveHorizontal) {
            point_to_add = [p, 0];
        } else {
            point_to_add = [0, p];
        }
        var e = makerjs.point.add(previous_point, point_to_add);
        points.push(e);

        // flip direction each time
        moveHorizontal = !moveHorizontal;
    });

    return points;
}
function PixelWalker(firstPoint, pixel_path) {

    // go clockwise starting first point
    var points = [];
    points.push(firstPoint);

    var moveHorizontal = true;	// alternate horizontal and vertical movements to form pixel heart

    pixel_path.forEach(function (p) {

        var previous_point = points[points.length - 1];
        var point_to_add;

        if (moveHorizontal) {
            point_to_add = [p, 0];
        } else {
            point_to_add = [0, p];
        }
        var e = makerjs.point.add(previous_point, point_to_add);
        points.push(e);

        // flip direction each time
        moveHorizontal = !moveHorizontal;
    });

    return points;
}
function PixelWalker ( firstPoint , pixel_path ) { // go clockwise starting first point var points = [ ] ; points . push ( firstPoint ) ; var moveHorizontal = true ; // alternate horizontal and vertical movements to form pixel heart pixel_path . forEach ( function ( p ) { var previous_point = points [ points . length - 1 ] ; var point_to_add ; if ( moveHorizontal ) { point_to_add = [ p , 0 ] ; } else { point_to_add = [ 0 , p ] ; } var e = makerjs . point . add ( previous_point , point_to_add ) ; points . push ( e ) ; // flip direction each time moveHorizontal = ! moveHorizontal ; } ) ; return points ; }
starting point so the heart is located properly in space 
Builds an array of points that define a model by generating points
from the `path` defined above.
starting point so the heart is located properly in space Builds an array of points that define a model by generating points from the path defined above .