scenejs icon indicating copy to clipboard operation
scenejs copied to clipboard

What is the proper way to add items dynamically?

Open tareq0065 opened this issue 3 years ago • 3 comments

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 avatar Nov 08 '22 22:11 tareq0065

@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.

daybrush avatar Nov 19 '22 04:11 daybrush

There is any update on this ? i need to re-create the useScene paremeters, how can i do that ?

Allakazan avatar Feb 07 '23 21:02 Allakazan

@Allakazan

There is a set function in the result of useScene.

Use the set(....) function.

https://github.com/daybrush/scenejs/issues/84#issuecomment-1422724347

daybrush avatar Feb 08 '23 14:02 daybrush