Not sure if you noticed that when we animate a Tile using sequence, the items in the tile start animating at the top left and go across the columns and then down the rows or if we sequenceReverse then from the bottom right to the top left. What if we want to animate from the center out! Here is an example of what that can look like and it is very cool! ZIM 016 - Normalize and Ratio - Code Creativity
The new normalize() method of a Container lets you give each child of the container a ratio (0-1) as to how popular it is compared to the other children relative to a starting, ending or central point. Ya... a little confusing sounding! An example will help:
const item = new Rectangle(70,70,white,black).reg(CENTER);
const tile = new Tile(item, 9, 1, 20)
.normalize("x", CENTER)
.center();
// scale the items based on the distance from the center
tile.loop(item=>{
zogy(decimals(item.ratio)); // 0, .3, .5, .8, 1, .8, .5, .3, 0
item.sca(.5 + item.ratio*2);
});
// optionally, adjust the spacing by re-tiling the scaled items
const final = new Tile({
obj:tile.items,
cols:tile.items.length,
rows:1,
spacingH:10,
unique:true, // avoid ZIM VEE picking from array
valign:CENTER
}).center()
tile.dispose(); // get rid of old empty tile
tile.sortBy("ratio"); // make more central objects come to front
Or with a spacingH of -10 above: