Skip to content

Instantly share code, notes, and snippets.

@theredstapler
Created June 6, 2016 14:21
Show Gist options
  • Select an option

  • Save theredstapler/a1a2f051aa5c8b6cd72b4c1ab936e4a2 to your computer and use it in GitHub Desktop.

Select an option

Save theredstapler/a1a2f051aa5c8b6cd72b4c1ab936e4a2 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="jquery.min.js"></script>
<script src="fabric.min.js"></script>
</head>
<body>
<canvas id="c" width="800" height="600"></canvas>
<script>
var canvas = new fabric.Canvas('c');
fabric.Image.fromURL('minion.png', function(img){
img.setWidth(200);
img.setHeight(200);
canvas.add(img);
img.animate('left','+=100',{
onChange: canvas.renderAll.bind(canvas),
duration: 1000,
easing: fabric.util.ease.easeOutBounce
});
img.animate('angle','+=5',{
onChange: canvas.renderAll.bind(canvas),
duration: 1000
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment