Last active
November 16, 2015 01:51
-
-
Save Saqoosha/61993158a70981b1b8bb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var fs = require('fs') | |
var data = JSON.parse(fs.readFileSync('keyframes.json')) | |
for (var key in data.user.property) { | |
console.log(key) | |
} | |
// console.log(data.user.property.position) | |
var position = data.user.property.position | |
var vertices = [] | |
data.user.property.face_vertices.forEach((v) => { | |
vertices.push.apply(vertices, v) | |
}) | |
console.log(vertices.length) | |
var buffer = new Buffer(vertices.length * 4) | |
for (var i = 0; i < vertices.length; i++) { | |
buffer.writeFloatLE(vertices[i], i * 4) | |
} | |
fs.writeFileSync('position.json', JSON.stringify(vertices)) | |
fs.writeFileSync('position.bin', buffer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment