request animation frame
var label = document.getElementById("vehicleGroup2");
move = function (){
var timePassed = Date.now() - startTime,
xOffset = Math.round(verticalSpeed * timePassed),
yOffset = Math.round(horisontalSpeed * timePassed);
if (xOffset <= toX) {
label.setAttribute("transform", "translate (" + xOffset + ", "+ yOffset+")");
} else {
label.setAttribute("transform", "translate (0,0)");
startTime = Date.now();
}
requestAnimationFrame(move);
};
var duration = 10 * 1000,
toY = 100,
toX = 100,
verticalSpeed = toY/duration,
horisontalSpeed = toX/duration,
startTime = Date.now();
move();