Rectangles with different sizes:
const sizes = [[30, 12], [30, 20], [30, 30], [30, 50]]
canvas.nodes([1, 2, 3, 4]).data(sizes).add({
pos: (_, i) => [(i - 1.5) * 75, 0],
shape: 'rect',
size: s => s
})
Change and animate size:
canvas.nodes([1, 2, 3]).add()
canvas.edges([[1, 2], [2, 3]]).add()
canvas.pause(0.5)
canvas.node(1).size('1.5x').pause(0.5)
canvas.node(2).size('2x').pause(0.5)
canvas.node(3).size('2.5x').pause(1)
canvas.nodes([1, 2, 3]).highlight(0).size('0.75x')