animate-canvas-line
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "animate-canvas-line", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -10,3 +10,6 @@ "main": "script.js", | ||
"author": "John De Mott <heydemo13@gmail.com>", | ||
"license": "ISC" | ||
"license": "ISC", | ||
"dependencies": { | ||
"q": "1.4.1" | ||
} | ||
} |
@@ -0,2 +1,6 @@ | ||
var Q = require('q'); | ||
function animateLine({ canvas, from, to, time = 1000, props = { }, number_of_steps = 100 }) { | ||
let deferred = Q.defer(); | ||
let x_interval = (to.x - from.x) / number_of_steps; | ||
@@ -26,4 +30,7 @@ let y_interval = (to.y - from.y) / number_of_steps; | ||
clearInterval(timer); | ||
deferred.resolve(); | ||
} | ||
}, time / number_of_steps); | ||
return deferred.promise; | ||
} | ||
@@ -30,0 +37,0 @@ |
1441
29
1