[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-3327":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},3327,"paper.js","paperjs\u002Fpaper.js","paperjs","The Swiss Army Knife of Vector Graphics Scripting – Scriptographer ported to JavaScript and the browser, using HTML5 Canvas. Created by @lehni & @puckey","http:\u002F\u002Fpaperjs.org",null,"JavaScript",15052,1259,393,374,0,3,23,9,44.3,"Other",false,"develop",[],"2026-06-12 02:00:48","# Paper.js - The Swiss Army Knife of Vector Graphics Scripting [![Build Status](https:\u002F\u002Ftravis-ci.org\u002Fpaperjs\u002Fpaper.js.svg?branch=develop)](https:\u002F\u002Ftravis-ci.org\u002Fpaperjs\u002Fpaper.js) [![NPM](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Fpaper.svg)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fpaper)\n\nIf you want to work with Paper.js, simply download the latest \"stable\" version\nfrom [http:\u002F\u002Fpaperjs.org\u002Fdownload\u002F](http:\u002F\u002Fpaperjs.org\u002Fdownload\u002F)\n\n- Website: \u003Chttp:\u002F\u002Fpaperjs.org\u002F>\n- Questions: \u003Chttps:\u002F\u002Fstackoverflow.com\u002Fquestions\u002Ftagged\u002Fpaperjs>\n- Discussion forum: \u003Chttps:\u002F\u002Fgroups.google.com\u002Fgroup\u002Fpaperjs>\n- Mainline source code: \u003Chttps:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js>\n- Twitter: [@paperjs](https:\u002F\u002Ftwitter.com\u002Fpaperjs)\n- Latest releases: \u003Chttp:\u002F\u002Fpaperjs.org\u002Fdownload\u002F>\n- Pre-built development versions:\n  [`prebuilt\u002Fmodule`](https:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js\u002Ftree\u002Fprebuilt\u002Fmodule)\n  and [`prebuilt\u002Fdist`](https:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js\u002Ftree\u002Fprebuilt\u002Fdist)\n  branches.\n\n## Installing Paper.js\n\nThe recommended way to install and maintain Paper.js as a dependency in your\nproject is through the [Node.js Package Manager (NPM)](https:\u002F\u002Fwww.npmjs.com\u002F)\nfor browsers, Node.js or Electron.\n\nIf NPM is already installed, simply type one of these commands in your project\nfolder:\n\n```sh\nnpm install paper\n```\n\nUpon execution, you will find a `paper` folder inside the project's\n`node_modules` folder.\n\nFor more information on how to install Node.js and NPM, read the chapter\n[Installing Node.js and NPM](#installing-nodejs-and-npm).\n\n### Which Version to Use\n\nThe various distributions come with two different pre-build versions of\nPaper.js, in minified and normal variants:\n\n- `paper-full.js` – The full version for the browser, including PaperScript\n  support and Acorn.js\n- `paper-core.js` – The core version for the browser, without PaperScript\n  support nor Acorn.js. You can use this to shave off some bytes and compilation\n  time when working with JavaScript directly.\n\n### Installing Node.js and NPM\n\nNode.js comes with the Node Package Manager (NPM). There are many tutorials\nexplaining the different ways to install Node.js on different platforms. It is\ngenerally not recommended to install Node.js through OS-supplied package\nmanagers, as the its development cycles move fast and these versions are often\nout-of-date.\n\nOn macOS, [Homebrew](https:\u002F\u002Fbrew.sh\u002F) is a good option if one version of\nNode.js that is kept up to date with `brew upgrade` is enough:  \n\u003Chttps:\u002F\u002Ftreehouse.github.io\u002Finstallation-guides\u002Fmac\u002Fnode-mac.html>\n\n[NVM](https:\u002F\u002Fgithub.com\u002Fcreationix\u002Fnvm) can be used instead to install and\nmaintain multiple versions of Node.js on the same platform, as often required by\ndifferent projects:  \n\u003Chttps:\u002F\u002Fnodesource.com\u002Fblog\u002Finstalling-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu\u002F>\n\nHomebrew is recommended on macOS also if you intend to install Paper.js with\nrendering to the Canvas on Node.js, as described in the next paragraph.\n\nFor Linux, see \u003Chttps:\u002F\u002Fnodejs.org\u002Fdownload\u002F> to locate 32-bit and 64-bit\nNode.js binaries as well as sources, or use NVM, as described in the paragraph\nabove.\n\n### Installing Paper.js Using NPM\n\nPaper.js comes in three different versions on NPM: `paper`, `paper-jsdom` and\n`paper-jsdom-canvas`. Depending on your use case, you need to required a\ndifferent one:\n\n- `paper` is the main library, and can be used directly in a browser\n  context, e.g. a web browser or worker.\n- `paper-jsdom` is a shim module for Node.js, offering headless use with SVG\n  importing and exporting through [jsdom](https:\u002F\u002Fgithub.com\u002Ftmpvar\u002Fjsdom).\n- `paper-jsdom-canvas` is a shim module for Node.js, offering canvas rendering\n  through [Node-Canvas](https:\u002F\u002Fgithub.com\u002FAutomattic\u002Fnode-canvas) as well as\n  SVG importing and exporting through [jsdom](https:\u002F\u002Fgithub.com\u002Ftmpvar\u002Fjsdom).\n\nIn order to install `paper-jsdom-canvas`, you need the [Cairo Graphics\nlibrary](https:\u002F\u002Fcairographics.org\u002F) installed in your system:\n\n### Installing Native Dependencies\n\nPaper.js relies on [Node-Canvas](https:\u002F\u002Fgithub.com\u002FAutomattic\u002Fnode-canvas) for\nrendering, which in turn relies on the native libraries\n[Cairo](https:\u002F\u002Fcairographics.org\u002F) and [Pango](https:\u002F\u002Fwww.pango.org\u002F).\n\n#### Installing Native Dependencies on macOS\n\nPaper.js relies on Node-Canvas for rendering, which in turn relies on Cairo and\nPango. The easiest way to install Cairo is through\n[Homebrew](https:\u002F\u002Fbrew.sh\u002F), by issuing the command:\n\n    brew install cairo pango\n\nNote that currently there is an issue on macOS with Cairo. If the above causes\nerrors, the following will most likely fix it:\n\n    PKG_CONFIG_PATH=\u002Fopt\u002FX11\u002Flib\u002Fpkgconfig\u002F npm install paper\n\nAlso, whenever you would like to update the modules, you will need to execute:\n\n    PKG_CONFIG_PATH=\u002Fopt\u002FX11\u002Flib\u002Fpkgconfig\u002F npm update\n\nIf you keep forgetting about this requirement, or would like to be able to type\nsimple and clean commands, add this to your `.bash_profile` file:\n\n    # PKG Config for Pango \u002F Cairo\n    export PKG_CONFIG_PATH=\u002Fusr\u002Flocal\u002Flib\u002Fpkgconfig:\u002Fopt\u002FX11\u002Flib\u002Fpkgconfig\n\nAfter adding this line, your commands should work in the expected way:\n\n    npm install paper\n    npm update\n\n#### Installing Native Dependencies on Debian\u002FUbuntu Linux\n\n    sudo apt-get install pkg-config libcairo2-dev libpango1.0-dev libssl-dev libjpeg62-dev libgif-dev\n\nYou might also need to install the build-essential package if you don't usually\nbuild from c++ sources:\n\n    sudo apt-get install build-essential\n\n#### Installing Native Dependencies for Electron\n\nIn order to build Node-Canvas for use of `paper-jsdom-canvas` in Electron, which\nis likely to use a different version of V8 than the Node binary installed in\nyour system, you need to manually specify the location of Electron’s headers.\nFollow these steps to do so:\n\n[Electron — Using Native Node\nModules](https:\u002F\u002Felectron.atom.io\u002Fdocs\u002Ftutorial\u002Fusing-native-node-modules\u002F)\n\n#### After Native Dependencies have been installed\n\nYou should now be able to install the Paper.js module with jsdom and Canvas\nrendering from NPM:\n\n    npm install paper-jsdom-canvas\n\n## Development\n\nThe main Paper.js source tree is hosted on\n[GitHub](https:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js\u002F). `git` is required to create a\nclone of the repository, and can be easily installed through your preferred\npackage manager on your platform.\n\n### Get the Source\n\n    git clone --recursive git:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js.git\n    cd paper.js\n\nTo refresh your clone and fetch changes from origin, run:\n\n    git fetch origin\n\nTo update the `jsdoc-toolkit` submodule, used to generate the documentation,\nrun:\n\n    git submodule update  --init --recursive\n\n### Setting Up For Building\n\nPaper.js uses [Gulp.js](https:\u002F\u002Fgulpjs.com\u002F) for building, and has a couple of\ndependencies as NPM modules. Read the chapter [Installing Node.js and\nNPM](#installing-nodejs-and-npm) if you still need to install these.\n\nDue to a conflict in Gulp 3 that could only be resolved using package\nresolution, we recently switched from NPM to `yarn` for development, which also\nneeds to be installed now. See\n[Installing Yarn](https:\u002F\u002Fclassic.yarnpkg.com\u002Fen\u002Fdocs\u002Finstall\u002F) for details.\n\nIn order to be able to build Paper.js, after checking out the repository, paper\nhas dependencies that need to be installed. Install them by issuing the\nfollowing commands from the Paper.js directory:\n\n    yarn install\n\n### Building the Library\n\nThe Paper.js sources are distributed across many separate files, organised in\nsubfolders inside the `src` folder. To compile them all into distributable\nfiles, you can run the `build` task:\n\n    yarn build\n\nYou will then find the built library files inside the `dist` folder, named\n`paper-full.js` and `paper-core.js`, along with their minified versions. Read\nmore about this in [Which Version to Use?](#which-version-to-use).\n\n### Running Directly from Separate Source Files\n\nAs a handy alternative to building the library after each change to try it out\nin your scripts, there is the `load` task, that replaces the built libraries\nwith symbolic links to the `scrc\u002Fload.js` script. This script then load the\nlibrary directly from all the separate source files in the `src` folder, through\nthe [Prepro.js](https:\u002F\u002Fgithub.com\u002Flehni\u002Fprepro.js) JavaScript preprocessing\nlibrary.\n\nThis means you can switch between loading from sources and loading a built\nlibrary simply by running.\n\n    yarn load\n\nAnd to go back to a built library\n\n    yarn build\n\nNote that your PaperScripts examples do not need to change, they can keep\nloading `dist\u002Fpaper-full.js`, which will always do the right thing. Note also\nthat `src\u002Fload.js` handles both browsers and Node.js, as supported by Prepro.js.\n\n### Other Build Tasks\n\nCreate a final zipped distribution file inside the `dist` folder:\n\n    yarn dist\n\n### Branch structure\n\nSince the release of version `0.9.22`, Paper.js has adopted aspects of the Git-\nFlow workflow. All development is taking place in the\n[`develop`](https:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js\u002Ftree\u002Fdevelop) branch, which is\nonly merged into [`master`](https:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js\u002Ftree\u002Fmaster)\nwhen a new release occurs.\n\nAs of version `0.9.26`, the `dist` folder is excluded on all branches, and the\nbuilding is now part of the `yarn publish` process by way of the `prepublish`\nscript.\n\nWe also offer prebuilt versions of the latest state of the `develop` branch on\n[`prebuilt\u002Fmodule`](https:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js\u002Ftree\u002Fprebuilt\u002Fmodule)\nand [`prebuilt\u002Fdist`](https:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js\u002Ftree\u002Fprebuilt\u002Fdist).\n\n### Building the Documentation\n\nSimilarly to building the library, you can run the `docs` task to build the\ndocumentation:\n\n    yarn docs\n\nYour docs will then be located at `dist\u002Fdocs`.\n\n### Testing\n\nPaper.js was developed and tested from day 1 using proper unit testing through\njQuery's [Qunit](https:\u002F\u002Fqunitjs.com\u002F). To run the tests after any\nchange to the library's source, simply open `index.html` inside the `test`\nfolder in your web browser. There should be a green bar at the top, meaning all\ntests have passed. If the bar is red, some tests have not passed. These will be\nhighlighted and become visible when scrolling down.\n\nIf you are testing on Chrome, some of the tests will fail due to the browser's\nCORS restrictions. In order to run the browser based tests on Chrome, you need\nto run a local web-server through Gulp.js. The following command will handle it\nfor you, and will also open the browser at the right address straight away:\n\n    yarn test:browser\n\nYou can also run the unit tests through PhantomJS in Gulp directly on the\ncommand line:\n\n    yarn test:phantom\n\nTo test the Node.js version of Paper.js, use this command:\n\n    yarn test:node\n\nAnd to test both the PhantomJS and Node.js environments together, simply run:\n\n    yarn test\n\n### Contributing [![Open Source Helpers](https:\u002F\u002Fwww.codetriage.com\u002Fpaperjs\u002Fpaper.js\u002Fbadges\u002Fusers.svg)](https:\u002F\u002Fwww.codetriage.com\u002Fpaperjs\u002Fpaper.js)\n\nThe main Paper.js source tree is hosted on GitHub, thus you should create a fork\nof the repository in which you perform development. See\n\u003Chttps:\u002F\u002Fhelp.github.com\u002Farticles\u002Ffork-a-repo\u002F>.\n\nWe prefer that you send a\n[pull request on GitHub](https:\u002F\u002Fhelp.github.com\u002Farticles\u002Fabout-pull-requests\u002F) \nwhich will then be merged into the official main line repository.\nYou need to sign the Paper.js CLA to be able to contribute (see below).\n\nAlso, in your first contribution, add yourself to the end of `AUTHORS.md` (which\nof course is optional).\n\nIn addition to contributing code you can also triage issues which may include\nreproducing bug reports or asking for vital information, such as version numbers\nor reproduction instructions. If you would like to start triaging issues, one\neasy way to get started is to\n[subscribe to paper.js on CodeTriage](https:\u002F\u002Fwww.codetriage.com\u002Fpaperjs\u002Fpaper.js).\n\n**Get the source (for contributing):**\n\nIf you want to contribute to the project you will have to [make a\nfork](https:\u002F\u002Fhelp.github.com\u002Farticles\u002Ffork-a-repo\u002F). Then do this:\n\n    git clone --recursive git@github.com:yourusername\u002Fpaper.js.git\n    cd paper.js\n    git remote add upstream git@github.com:paperjs\u002Fpaper.js.git\n\nTo then fetch changes from upstream, run\n\n    git fetch upstream\n\n#### Creating and Submitting a Patch\n\nAs mentioned above, we prefer that you send a\n[pull request](https:\u002F\u002Fhelp.github.com\u002Farticles\u002Fabout-pull-requests\u002F) on GitHub:\n\n1. Create a fork of the upstream repository by visiting\n   \u003Chttps:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js\u002Ffork>. If you feel insecure, here's a\n   great guide: \u003Chttps:\u002F\u002Fhelp.github.com\u002Farticles\u002Ffork-a-repo\u002F>\n\n2. Clone of your repository: `git clone\n   https:\u002F\u002Fyourusername@github.com\u002Fyourusername\u002Fpaper.js.git`\n\n3. This is important: Create a so-called *topic branch* based on the `develop`\n   branch: `git checkout -tb name-of-my-patch develop` where `name-of-my-patch`\n   is a short but descriptive name of the patch you're about to create. Don't\n   worry about the perfect name though -- you can change this name at any time\n   later on.\n\n4. Hack! Make your changes, additions, etc., commit them then push them to your\n   GitHub fork: `git push origin name-of-my-patch`\n\n5. Send a pull request to the upstream repository's owner by visiting your\n   repository's site at GitHub (i.e. https:\u002F\u002Fgithub.com\u002Fyourusername\u002Fpaper.js)\n   and press the \"Pull Request\" button. Make sure you are creating the pull\n   request to the `develop` branch, not the `master` branch. Here's a good guide\n   on pull requests: \u003Chttps:\u002F\u002Fhelp.github.com\u002Farticles\u002Fabout-pull-requests\u002F>\n\n##### Use one topic branch per feature:\n\nDon't mix different kinds of patches in the same branch. Instead, merge them all\ntogether into your `develop` branch (or develop everything in your `develop`\nbranch and then cherry-pick-and-merge into the different topic branches). Git\nprovides for an extremely flexible workflow, which in many ways causes more\nconfusion than it helps you when new to collaborative software development. The\nguides provided by GitHub at \u003Chttps:\u002F\u002Fhelp.github.com\u002F> are a really good\nstarting point and reference. If you are fixing an issue, a convenient way to\nname the branch is to use the issue number as a prefix, like this: `git checkout\n-tb issue-937-feature-add-text-styling`.\n\n#### Contributor License Agreement\n\nBefore we can accept any contributions to Paper.js, you need to sign this\n[CLA](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FContributor_License_Agreement):\n\n[Contributor License Agreement](https:\u002F\u002Fspreadsheets.google.com\u002Fa\u002Fpaperjs.org\u002Fspreadsheet\u002Fembeddedform?formkey=dENxd0JBVDY2REo3THVuRmh4YjdWRlE6MQ)\n\n> The purpose of this agreement is to clearly define the terms under which\n> intellectual property has been contributed to Paper.js and thereby allow us to\n> defend the project should there be a legal dispute regarding the software at\n> some future time.\n\nFor a list of authors and contributors, please see \n[AUTHORS](https:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js\u002Fblob\u002Fmaster\u002FAUTHORS.md).\n\n## License\n\nDistributed under the MIT license. See \n[LICENSE](https:\u002F\u002Fgithub.com\u002Fpaperjs\u002Fpaper.js\u002Fblob\u002Fmaster\u002FLICENSE.txt)\nfor details.\n","Paper.js 是一个强大的矢量图形脚本库，它将 Scriptographer 移植到了 JavaScript 和浏览器环境，利用 HTML5 Canvas 进行渲染。其核心功能包括支持路径、形状等矢量图形操作，以及提供 PaperScript 语言以简化代码编写。技术特点上，Paper.js 提供了丰富的API和灵活的事件处理机制，使得开发者能够轻松创建复杂的交互式图形应用。适用于需要在网页或Node.js环境中进行矢量图形绘制与编辑的应用场景，如在线绘图工具、游戏开发中的图形渲染等。",2,"2026-06-11 02:53:35","top_language"]