The PaperScope
class represents the scope associated with a Paper context. When working with PaperScript, these scopes are automatically created for us, and through clever scoping the properties and methods of the active scope seem to become part of the global scope.
When working with normal JavaScript code, PaperScope
objects need to be manually created and handled.
Paper classes can only be accessed through PaperScope
objects. Thus in PaperScript they are global, while in JavaScript, they are available on the global paper
object. For JavaScript you can use paperScope.install(scope)
to install the Paper classes and objects on the global scope. Note that when working with more than one scope, this still works for classes, but not for objects like paperScope.project
, since they are not updated in the injected scope if scopes are switched.
The global paper
object is simply a reference to the currently active PaperScope
.
PaperScope()
version
settings
project
projects
view
tool
tools
execute(code[, options])
install(scope)
setup(element)
activate()