Canvas: Create-animate
learn Canvas Layer - Element creation and animation of its attributes.
Last updated
learn Canvas Layer - Element creation and animation of its attributes.
Last updated
let renderer = i2d.canvasLayer('#myCanvas', {}, {});let circle = renderer.createEl({
el: 'circle',
attr: {
r: 50,
cx: renderer.width / 2,
cy: renderer.height / 2
},
style: {
fillStyle: '#ff0000'
}
})let circle = renderer.createEls([1,2,3,4], {
el: 'circle',
attr: {
r: 50,
cx: function (d) { return d * 100 },
cy: function (d) { return d * 100 }
},
style: {
fillStyle: '#ff0000'
}
})circle.animateTo({
duration: 500,
loop: 10,
ease: 'easeInOutSin',
direction: 'alternate',
attr: {
r: 200
},
style: {
fillStyle: '#00ff00'
}
});