Skip to content Skip to sidebar Skip to footer

SetAngle Is Not A Function Fabricjs

I recently started to work with fabricjs, and I have a question about connectivity object. i do creating sample demo for connectivity from parent object to child object connect wi

Solution 1:

Build doesn't have setter/getter (optional). You can make your build here with Named accessors. If you want to set angle you can use

obj.angle = text;
//or
obj.set({
 angle:angle
});
//or
obj.set('angle', angle);

DEMO

var canvas = new fabric.Canvas('c');
var triangle = new fabric.Triangle({
  left: 150,
  top: 50,
  width: 300,
  height:200,
  fill:'',
  stroke:'red'
})

canvas.add(triangle);
triangle.set('angle',40);
//triangle.angle = 40;
//triangle.set({angle : 40})
canvas{
 border:1px solid #000;
}
<script type="text/javascript" src="
https://rawgit.com/kangax/fabric.js/master/dist/fabric.js"></script>
<canvas id="c" width="400" height="400"></canvas>

Post a Comment for "SetAngle Is Not A Function Fabricjs"