I was looking for a solution too, so I implemented one. This takes a list of generated path segments and draws them one by one.
You need to describe your path as a list instead of a string.
ie, instead of using "M 90,100 H90,200"
use pathList = [["M", 90, 100], ["H", 90,200]]
/**
Animates drawing the path on the Paper
@param {Paper} paper on which to draw
@param {array} pathList of segments to draw
@param {number} interval or time it takes to draw a segment
*/
function draw(paper, pathList, interval) {
// set default interval
interval = interval || 300;
if (pathList.length <= 0) return;
currentPath = paper.path(pathList[0]);
drawNextPart(pathList, currentPath, 2, interval);
}
/**
Recursive subroutine that animates drawing segments of path
@param {array} pathList of segments to draw
@param {Path Object} currentPath to add segment to
@param {number} index of next segment being drawn
@param {number} interval or time it takes to draw a segment
*/
function drawNextPart(pathList, currentPath, index, interval) {
console.log('drawing part', index - 1, '/', pathList.length);
if (index > pathList.length) return;
let nextPart = pathList.slice(0, index);
currentPath.animate({path: nextPart}, interval, function() {
drawNextPart(pathList, currentPath, index + 1, interval);
});
}