0

Following Famo.us University Animation part. The following code didn't halt the translation, instead runs straight to the end. I expected it halted where it is clicked. Am I right?

surface.on('click', function() {
  stateModifier.halt();
  surface.setContent('halted');
});

Thanks

Fei
  • 455
  • 1
  • 5
  • 16

1 Answers1

0

The answer is: It will halt the transform, but will complete at the transforms final position

That is why you see the jump from where it is clicked.

Rather than halt the Transform just set the transform to the current Transform position.

Example jsBin

  surface.on('click', function() {
    //stateModifier.halt();
    stateModifier.setTransform(stateModifier.getTransform());
    surface.setContent('Halted');
  });
talves
  • 13,993
  • 5
  • 40
  • 63
  • Thanks for the hint. Interestingly the document of StateModifier says halt(): stop the transition. But transition dump to the final stage instead, which I didn't expected. I really don't like much of the Famo.us' documentation per se. – Fei Dec 24 '14 at 12:58