Last active
December 21, 2015 20:29
-
-
Save esmasui/6362081 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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