scenejs
scenejs copied to clipboard
What is the proper way to add items dynamically?
I need to add the scene items dynamically. But when I add any new item, it's stacked and animations are not working. I have tried to add new item like below. What will be the proper way to add items dynamically?
Description
const newLayer = JsCanvas.newItem(`.Layer-${name}`, {
iterationCount: 1,
selector: true,
delay: delay,
});
newLayer.set(keyframes);
JsCanvas.setItem(`.Layer-${name}`, newLayer);
@tareq0065
Calling the newItem and set methods is the correct usage and is the way to add items dynamically.
Is there any demo? It is difficult to determine the cause of this alone.
There is any update on this ? i need to re-create the useScene paremeters, how can i do that ?
@Allakazan
There is a set function in the result of useScene.
Use the set(....) function.
https://github.com/daybrush/scenejs/issues/84#issuecomment-1422724347