scel.pi
scel.pi

Reputation: 703

How to change current container on createJS

I`m making one stereoscopic animation with createjs, a lot of balls rolls to you without collision, but they have different speeds. They start with scale .001 (far away) to 1 (when hits you), the balls have differents speeds, so if one ball grow faster than other, it should become in the front the others too, so i have created 1000 containers, and if i multiply (scaleX or Y to 1000) i got the desired container. If i dont do this the ball position (front or behind) will be defined by the creation order. the newest one created will be in the front, and the oldest behind.

But how can i change the ball to another container?

Upvotes: 0

Views: 533

Answers (1)

rpg600
rpg600

Reputation: 2850

Create 1000 container is a bad idea.

The best way is to create one container and use sortChildren or swapChildren methods to change the order of the balls.

http://www.createjs.com/Docs/EaselJS/classes/Container.html#method_sortChildren

Upvotes: 0

Related Questions