最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Raphael order objects - Stack Overflow

programmeradmin4浏览0评论

I'm trying to order Raphael objects. I don't have the option of deciding when the objects are created, but I'd like to make a group of objects appear behind a group of other objects after they've been created. Can anybody help me do this?

Thanks.

I'm trying to order Raphael objects. I don't have the option of deciding when the objects are created, but I'd like to make a group of objects appear behind a group of other objects after they've been created. Can anybody help me do this?

Thanks.

Share Improve this question asked Dec 9, 2010 at 0:34 So8resSo8res 10.4k9 gold badges58 silver badges88 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 12

Group you items in two sets and position the sets relative to each other with insertBefore or insertAfter:

var front = paper.set();
front.push(front1, front2);

var back = paper.set();
back.push(back1, back2);

front.insertBefore(back);

Also if you have your items in arrays you can use apply for convenience:

var frontItems = [front1, front2];
front.push.apply(null, frontItems);

You can use toBack. http://raphaeljs./reference.html#toBack

It will put an object behind the other objects regardless of when you created it.

发布评论

评论列表(0)

  1. 暂无评论