Search code examples
paperjs

Whats the difference between a clone and a symbol


just wondering what the difference between a clone and a symbol in paper.js. Thanks.


Solution

  • A clone is just a copy of an item that makes it an independent instance which can have its own properties (fill, stroke, ...). The most common use case for it is having a quick way to create an item similar to another, avoiding creating it from scratch.
    When the source of the cloned item is modified, the cloned item doesn't change.

    A symbol item is an identical copy of an item (its related symbol definition) that can only have its own matrix tranformations (translation, rotation, ...) but not its own style (fill, stroke, ...). The most common use case for it is performance optimization when the same item has to be repeated multiple time (e.g. drawing a sky full of stars).
    When the symbol definition of the symbol item is modified, the symbol item is updated.