UNPKG

skeletal-animation-system

Version:

A standalone, stateless, dual quaternion based skeletal animation system built with interactive applications in mind

50 lines (46 loc) 1.33 kB
var bench = require('nanobench') var animationSystem = require('../') /** * TODO: Threw in a benchmark, but need to be more deliberate about what we're benchmarking * and how to make things faster */ bench('Interpolate 20 bones one million times', function (b) { b.start() for (var i = 0; i < 1000000; i++) { animationSystem.interpolateJoints({ currentTime: i, keyframes: { 0: [ [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0] ], 100: [ [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1] ] }, jointNums: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], currentAnimation: { range: [0, 1], startTime: 0 } }) } b.end() })