borderrect | TypeParsableBuffer | TypeParsableBorder | children — defines border of collection. Use children to use the borders of
the children. Use 'rect' for the bounding rectangle of the borders
of the children. Use TypeParsableBuffer for the bounding rectangle of the
borders of the children with some buffer. Use TypeParsableBorder for
a custom border. ('children')
touchBorderrect | TypeParsableBuffer | TypeParsableBorder | children | border — defines the touch border of the collection. Use 'border' to use the same
as the border of the collection. Use children to use the touch borders of
the children. Use 'rect' for the bounding rectangle of the touch borders
of the children. Use TypeParsableBuffer for the bounding rectangle of the
touch borders of the children with some buffer. Use TypeParsableBorder for
a custom touch border. ('children')
Example
figure.add( { name:'c', make:'collection', elements: [ // add two elements to the collection { name:'hex', make:'polygon', sides:6, radius:0.5, }, { name:'text', make:'text', text:'hexagon', position: [0, -0.8], xAlign:'center', font: { size:0.3 }, }, ], }, );
// When a collection rotates, then so does all its elements figure.getElement('c').animations.new() .rotation({ target:Math.PI * 1.999, direction:1, duration:5 }) .start();
Example
// Collections and primitives can also be created from `figure.collections` // and `figure.primitives`. constc = figure.collections.collection(); consthex = figure.primitives.polygon({ sides:6, radius:0.5, }); consttext = figure.primitives.text({ text:'hexagon', position: [0, -0.8], xAlign:'center', font: { size:0.3 }, }); c.add('hex', hex); c.add('text', text); figure.add('c', c);
// When a collection rotates, then so does all its elements c.animations.new() .delay(1) .rotation({ target:Math.PI * 1.999, direction:1, duration:5 }) .start(); @interface
FigureElementCollection options object.
A collection is a group of other FigureElements that will all inherit the parent collections transform.
transformTypeParsableTransformpositionTypeParsablePoint — if defined, will overwrite first translation oftransformcolorTypeColor — default colorparentFigureElement |null— parent of collectionborderrect| TypeParsableBuffer | TypeParsableBorder |children— defines border of collection. Usechildrento use the borders of the children. Use'rect'for the bounding rectangle of the borders of the children. UseTypeParsableBufferfor the bounding rectangle of the borders of the children with some buffer. UseTypeParsableBorderfor a custom border. ('children')touchBorderrect| TypeParsableBuffer | TypeParsableBorder |children|border— defines the touch border of the collection. Use'border'to use the same as the border of the collection. Usechildrento use the touch borders of the children. Use'rect'for the bounding rectangle of the touch borders of the children. UseTypeParsableBufferfor the bounding rectangle of the touch borders of the children with some buffer. UseTypeParsableBorderfor a custom touch border. ('children')Example
Example