Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. // Creates a HTML5 video tag
  2. var canvas = new fabric.Canvas('canvas', {});
  3.  
  4. var square = new fabric.Rect({
  5. width: 100,
  6. height: 100,
  7. left: 100,
  8. top: 200,
  9. fill: 'red'
  10. });
  11.  
  12. canvas.add(square);
  13. canvas.renderAll();
  14. canvas.setActiveObject(square);
  15.  
  16. $('#next-frame').click( function() {
  17.  
  18. square.animate('left', 400, {
  19. duration: 1000,
  20. onChange: canvas.renderAll.bind(canvas),
  21. // byValue: 100,
  22. onComplete: function() {
  23. console.log('animation completed');
  24. },
  25. easing: fabric.util.ease['easeInQuad'],
  26. abort: function(){
  27. // return false;
  28. }
  29. });
  30.  
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement