Created
June 6, 2016 13:25
-
-
Save theredstapler/8ed2ce7749b34b165db7fed4737d8118 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="jquery.min.js"></script> | |
<script src="fabric.min.js"></script> | |
</head> | |
<body> | |
<canvas id="c" width="800" height="600"></canvas> | |
<input id="b" type="button" value="Go right" /> | |
<script> | |
var canvas = new fabric.Canvas('c'); | |
var rect = new fabric.Rect({ | |
left: 150, | |
top: 150, | |
fill: 'red', | |
width: 200, | |
height:200, | |
angle:45 | |
}); | |
canvas.add(rect); | |
$("#b").click(function(){ | |
rect.setLeft(rect.getLeft() + 10); | |
canvas.renderAll(); | |
console.log("Left: " + rect.getLeft()); | |
console.log("Top: " + rect.getTop()); | |
console.log("Angle: " + rect.getAngle()); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment