组合

通过 fabric.Group 可以将多个 fabric元素 进行组合:

var canvas =new fabric.Canvas('main');
var circle = new fabric.Circle({
  radius: 100,
  fill: '#f00',
  scaleY: 0.5,
  originX: 'center',
  originY: 'center'
});
var text = new fabric.Text('Hello World', {
  fontSize: 30,
  originX: 'center',
  originY: 'center'
})
// 进行组合
var group = new fabric.Group([circle, text], {
  left: 150,
  top: 100,
  angle: 10
})
canvas.add(group);

MIT Licensed | Copyright © 2018-present 滇ICP备16006294号

Design by Quanzaiyu | Power by VuePress