DmitryBaranovskiy / raphael

JavaScript Vector Library
https://dmitrybaranovskiy.github.io/raphael/
MIT License
11.27k stars 1.67k forks source link

rotation animation regression #1059

Closed gregbaker closed 8 years ago

gregbaker commented 8 years ago

There seems to be a regression in the way animation of rotations are calculated between versions 2.1.2 and 2.2.0. The intermediate steps in the rotation are no longer a smooth rotation, but involve shrinking the element.

This page demonstrates: clicking the shape should rotate it smoothly in 120 degree increments. Version "2.2.1" with "2.1.2" shows the expected behaviour.

<!DOCTYPE html> 
<html>
<head> 
<meta charset="UTF-8" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.2.1/raphael.js"></script>
<title>rotation bug</title>
</head> 
<body>
<div id="svg"></div>

<script>
(function() {
  var paper = Raphael('svg', 200, 200);
  var p = paper.path('M50,50 L150,50 L 50,150');

  var angle = 0;
  var svg = document.getElementById('svg');
  svg.addEventListener('click', function () {
    angle += 120
    p.animate({'transform': 'r'+angle}, 1000);
  });
})();
</script>

</body>
</html>
gregbaker commented 8 years ago

I just did a git bisect on the problem: the issue appears in f82a25f89b42749f2f91d8eb01bae8e79ff0a2bb which makes sense, since it introduces a change to the transform string.

tomasAlabes commented 8 years ago

Reverting this improvement until we can figure out what could be happening. @nlaplume any idea?