Skip to content

Instantly share code, notes, and snippets.

@esmasui
Last active December 21, 2015 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esmasui/6362081 to your computer and use it in GitHub Desktop.
Save esmasui/6362081 to your computer and use it in GitHub Desktop.
test( "pressure", function() {
var backing = MOON.getCurrentPage().backing;
var paper = MOON.getPaperJSON(backing);
//console.log(paper);
paper.strokes = [];
var pressure = 1.0;
var w = paper.width;
var h = paper.height
console.log(w + ", " + h);
for(var i = 0; i < 100; ++i) {
var y = h * 1 / 100.0 * i;
var data = [];
Array.prototype.push.apply(data, [0, y, pressure]);
for(var j = 0; j < i; ++j) {
Array.prototype.push.apply(data, [w * 1 / i * j, y, pressure]);
}
Array.prototype.push.apply(data, [w, y, pressure]);
console.log(data.length);
paper.strokes.push({
"type": "pen",
"color": -1,
"width": 2.5,
"data": data
});
}
MOON.setPaperJSON(backing, paper);
ok(true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment