JSFiddle 的链接:http: //jsfiddle.net/UTf87/ 由于某种原因,我的画布不会显示它应该显示的矩形,有什么线索吗?
hmtl:
<div id="CanvasContainer">
<canvas id="Canvas"></canvas>
</div>
CSS:
#CanvasContainer {
float: left;
width: 270px;
height: 519px;
margin-left: 15px;
background: black;
}
#Canvas {
float: left;
overflow: hidden;
background: green;
}
javascript:
window.onload = function () {
var canvas = new fabric.Canvas('CanvasContainer');
var rect = new fabric.Rect({
left: 100,
top: 100,
fill: 'red',
width: 20,
height: 20,
angle: 45
});
canvas.add(rect);
}