I have a list where I add remove elements:
let l = [1, 2, 3, 4, 5];
l.push(10);
l.pop();
l.splice(2, 1);I want to render this list where each item has a sprite laid out horizontally:
function renderList() {
l.forEach((_, i) => {
// create a sprite
let s = new Sprite(textures[_]);
// set the position
s.position.set(i * 10, 0);
// add to the stage
stage.addChild(s);
});
}
On each game update this list changes, so I need to update the scene graph somehow to reflect this, possible add new items to the stage, remove …