### Install Paper.js with jsdom and Canvas Source: https://github.com/paperjs/paper.js/blob/develop/README.md Installs the Paper.js module with jsdom and Canvas rendering capabilities after native dependencies have been successfully installed. ```shell npm install paper-jsdom-canvas ``` -------------------------------- ### Install Build Essentials on Debian/Ubuntu Source: https://github.com/paperjs/paper.js/blob/develop/README.md Installs the 'build-essential' package on Debian/Ubuntu systems, which is required for compiling C++ sources and is a prerequisite for some Paper.js dependencies. ```shell sudo apt-get install build-essential ``` -------------------------------- ### Install Paper.js Development Dependencies (Yarn) Source: https://github.com/paperjs/paper.js/blob/develop/README.md Installs the NPM dependencies required for developing and building Paper.js using Yarn, after cloning the repository. ```shell yarn install ``` -------------------------------- ### Install Native Dependencies on Debian/Ubuntu Linux Source: https://github.com/paperjs/paper.js/blob/develop/README.md Installs necessary development packages for Paper.js on Debian/Ubuntu systems, including Cairo, Pango, SSL, JPEG, and GIF development headers. ```shell sudo apt-get install pkg-config libcairo2-dev libpango1.0-dev libssl-dev libjpeg62-dev libgif-dev ``` -------------------------------- ### Paper.js Initialization and Setup Source: https://github.com/paperjs/paper.js/blob/develop/examples/Rasters/Raster.html This snippet demonstrates the basic setup for Paper.js, including initializing the PaperScope and creating a canvas element. It's essential for any Paper.js application. ```javascript var canvas = document.getElementById('myCanvas'); paper.setup(canvas); ``` -------------------------------- ### Install Native Dependencies on macOS (Homebrew) Source: https://github.com/paperjs/paper.js/blob/develop/README.md Installs Cairo and Pango, essential for Node-Canvas rendering in Paper.js, using Homebrew. This is the primary method for macOS installations. ```shell brew install cairo pango ``` -------------------------------- ### Install Dependencies with npm Source: https://github.com/paperjs/paper.js/blob/develop/examples/Rasters/Raster.html Installs project dependencies using npm. This command is essential for setting up the development environment and ensuring all necessary libraries are available. ```bash npm install ``` -------------------------------- ### Install Paper.js via NPM Source: https://github.com/paperjs/paper.js/blob/develop/README.md This command installs the Paper.js library as a project dependency using the Node Package Manager (NPM). It is the recommended method for projects running in browsers, Node.js, or Electron. ```sh npm install paper ``` -------------------------------- ### Clone Paper.js Repository Source: https://github.com/paperjs/paper.js/blob/develop/README.md Clones the Paper.js source code repository from GitHub, including all submodules, and navigates into the cloned directory. ```shell git clone --recursive git://github.com/paperjs/paper.js.git cd paper.js ``` -------------------------------- ### Create and Style a Path with Paper.js Source: https://github.com/paperjs/paper.js/blob/develop/examples/JSON/Raster.html This snippet demonstrates how to create a basic path in Paper.js, define its segments, and apply styling such as stroke color and width. It's a fundamental example for getting started with vector graphics in Paper.js. ```javascript var path = new Path(); path.strokeColor = 'black'; path.add(new Point(100, 100)); path.add(new Point(200, 200)); path.strokeWidth = 10; ``` -------------------------------- ### Load Paper.js from Source Files Source: https://github.com/paperjs/paper.js/blob/develop/README.md Switches Paper.js to load directly from source files using the 'load' Gulp task and Prepro.js. This is useful for development and testing without a full build. ```shell yarn load ``` -------------------------------- ### Configure PKG_CONFIG_PATH for macOS Source: https://github.com/paperjs/paper.js/blob/develop/README.md Adds the PKG_CONFIG_PATH export to the .bash_profile for persistent configuration of Pango and Cairo dependencies on macOS. This simplifies subsequent install and update commands. ```shell # PKG Config for Pango / Cairo export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig ``` -------------------------------- ### Fetch Origin Changes for Paper.js Source: https://github.com/paperjs/paper.js/blob/develop/README.md Fetches the latest changes from the 'origin' remote repository for Paper.js without merging them into the local branch. ```shell git fetch origin ``` -------------------------------- ### Install Paper.js with macOS Cairo/Pango Fix Source: https://github.com/paperjs/paper.js/blob/develop/README.md Installs Paper.js on macOS when encountering errors with Cairo, by setting the PKG_CONFIG_PATH environment variable. This ensures correct dependency resolution. ```shell PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/ npm install paper ``` -------------------------------- ### Basic PaperScript Setup with Canvas Source: https://github.com/paperjs/paper.js/blob/develop/examples/JSON/Raster.html Provides a minimal PaperScript setup, including linking to the Paper.js library and defining PaperScript code within a `