A collection is a group of other FigureElements that will all
inherit the parent collections transform.
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.
Example
Example