Raphael order objects

前端 未结 2 1542
一向
一向 2021-02-08 03:25

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

2条回答
  •  离开以前
    2021-02-08 03:31

    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);
    

提交回复
热议问题