Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KineticJS: Group vs. Layer

Despite my best Google-fu, nowhere in the main tutorial or the KineticJS docs does it explicitly state the difference between a group and a layer. Kinetic's "Getting Started" page sort of addresses this--it mentions that layers have special renderers, although I don't quite understand what that means. So do groups not have those renderers? Can groups not be inside of layers? What makes layers (or groups) different than just a parent to a bunch of nodes for organization/transformation?

Essentially, what's the difference between a group and a layer?

like image 832
Will Avatar asked Jan 05 '13 20:01

Will


1 Answers

Group is simply a collection of KineticJS defined objects within a layer, while each layer is a separate Canvas (or used to be until version 3.x of KineticJS) you can see the difference by adding multiple layers on a stage. Also, in the framework hierarchy, a group is contained inside a layer and not the other way around. So you can display/render multiple groups at one time but not multiple layers (only the topmost one is visible).

like image 106
Ani Avatar answered Oct 18 '22 10:10

Ani