javascript - Fabric.js geometric shapes -


i want use different geometric shapes (like hexagon, star...) apart rect, triangle, ellipse.what else can do? how can do?

var canvas = new fabric.canvas('c'); var rect = new fabric.rect({   left: 50,   top: 50,   fill: 'green',   width: 40,   height: 80 }); var circle = new fabric.circle({   radius: 20,    fill: 'red',    left: 100,    top: 100 }); 

you can polygon function:

var pol = new fabric.polygon([   {x: 200, y: 0},   {x: 250, y: 50},   {x: 250, y: 100},   {x: 150, y: 100},   {x: 150, y: 50} ], {     left: 250,     top: 150,     angle: 0,     fill: 'green'   } ); 

for more complex shapes should load svgs


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -