From f039e592e8410d1bcd414a00e43be42a9d6e9534 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Fri, 7 Aug 2020 10:53:50 +0200 Subject: [PATCH 001/158] Add Grunt tasks Grunt task that clone the p5.js repo, generate the data.json, move it in the p5.js-website repo, and finally generate the en.json. --- Gruntfile.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 304a0029bd..1a1b8dff1c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,6 +8,7 @@ const yaml = require('js-yaml'); const fs = require('fs').promises; +const fse = require('fs-extra'); const pkg = require('./package.json'); module.exports = function(grunt) { @@ -351,6 +352,27 @@ module.exports = function(grunt) { ] } } + }, + shell: { + make_tmp_dir: { + command: 'mkdir -p tmp/p5.js' + }, + clone_p5js_repo: { + command: 'git clone https://github.com/processing/p5.js .', + options: { + execOptions: { + cwd: 'tmp/p5.js' + } + } + }, + generate_dataJSON: { + command: 'npm i && npm run grunt yui', + options: { + execOptions: { + cwd: 'tmp/p5.js' + } + } + } } }); @@ -378,6 +400,35 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-html'); + grunt.registerTask('clone_p5js', [ + 'shell:make_tmp_dir', + 'shell:clone_p5js_repo' + ]); + + grunt.registerTask('generate_dataJSON', ['shell:generate_dataJSON']); + + grunt.registerTask('move_dataJSON', function() { + const dataJSON_p5js = 'tmp/p5.js/docs/reference/data.json'; + const dataJSON_p5jswebsite = 'src/templates/pages/reference/data.json'; + // move the data.json from the cloned p5.js repository to the p5.js-website repository + fse.moveSync(dataJSON_p5js, dataJSON_p5jswebsite, { overwrite: true }); + // delete the tmp folder that contained the p5.js repository + fse.removeSync('tmp/'); + }); + + grunt.registerTask('generate_enJSON', function() { + const getenJSON = require('./getenJSON.js'); + // generate and save the en.json + getenJSON(); + }); + + grunt.registerTask('update-enJSON', [ + 'clone_p5js', + 'generate_dataJSON', + 'move_dataJSON', + 'generate_enJSON' + ]); + // multi-tasks: collections of other tasks grunt.registerTask('server', [ 'build', From f74332d09a02f17440fe116db327264608bb4d3f Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Fri, 7 Aug 2020 11:00:36 +0200 Subject: [PATCH 002/158] Create config file for update-documentation workflow Workflows that updates both the data.json file and the en.json everytime a new p5.js release gets published. --- .github/workflows/update-documentation.yml | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/update-documentation.yml diff --git a/.github/workflows/update-documentation.yml b/.github/workflows/update-documentation.yml new file mode 100644 index 0000000000..ada2b31dd1 --- /dev/null +++ b/.github/workflows/update-documentation.yml @@ -0,0 +1,37 @@ +name: Update p5.js documentation + +on: + # This workflow is triggered by the p5.js repo on every new release. + repository_dispatch +env: + # These are the tag name and the commit sha of the p5.js release. + P5JS_REF: ${{github.event.client_payload.ref}} + P5JS_SHA: ${{github.event.client_payload.sha}} + +jobs: + build: + name: Update p5.js documentation + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v1 + - name: Install Node.JS 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Extract documentation from the p5.js repo + run: | + npm install + npm run grunt update-enJSON + - name: Get p5.js release info + id: p5js + run: | + echo ::set-output name=VERSION::${P5JS_REF/refs\/tags\//} + echo ::set-output name=SHA::${P5JS_SHA} + - name: Commit changes + uses: EndBug/add-and-commit@v4 + with: + message: 'Update reference files for p5.js ${{ steps.p5js.outputs.VERSION }} release (${{ steps.p5js.outputs.SHA }})' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 0bf97606b753477a653ba1230bacd0be11e3f02e Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Fri, 7 Aug 2020 11:40:41 +0200 Subject: [PATCH 003/158] Update package-lock.json --- package-lock.json | 109 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 645510e6b6..45fea56cde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1259,6 +1259,12 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true + }, "atob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", @@ -6937,6 +6943,26 @@ "integrity": "sha1-mC1ok6+RjnLQjeyehnP/K1qNat0=", "dev": true }, + "fs-extra": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", + "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^1.0.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true + } + } + }, "fs-utils": { "version": "0.3.10", "resolved": "https://registry.npmjs.org/fs-utils/-/fs-utils-0.3.10.tgz", @@ -8364,6 +8390,69 @@ } } }, + "grunt-shell": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/grunt-shell/-/grunt-shell-3.0.1.tgz", + "integrity": "sha512-C8eR4frw/NmIFIwSvzSLS4wOQBUzC+z6QhrKPzwt/tlaIqlzH35i/O2MggVOBj2Sh1tbaAqpASWxGiGsi4JMIQ==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "npm-run-path": "^2.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "grunt-uncss": { "version": "0.8.6", "resolved": "https://registry.npmjs.org/grunt-uncss/-/grunt-uncss-0.8.6.tgz", @@ -10203,6 +10292,16 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, + "jsonfile": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", + "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^1.0.0" + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -13060,7 +13159,6 @@ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, - "optional": true, "requires": { "path-key": "^2.0.0" } @@ -13730,8 +13828,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true, - "optional": true + "dev": true }, "path-parse": { "version": "1.0.6", @@ -19702,6 +19799,12 @@ } } }, + "universalify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", + "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", + "dev": true + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", From b2c19aa4b8cbd83866eeb89abb21cd403effb304 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Fri, 7 Aug 2020 11:42:10 +0200 Subject: [PATCH 004/158] Update package.json --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 4751eda749..d2e734ef3d 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "node": ">=0.10" }, "scripts": { + "grunt": "grunt", "assemble": "grunt assemble", "build": "grunt build", "test": "grunt build", @@ -46,6 +47,7 @@ "eslint": "^4.19.1", "eslint-config-prettier": "^2.10.0", "eslint-plugin-prettier": "^2.7.0", + "fs-extra": "^9.0.1", "grunt": "^1.1.0", "grunt-assemble": "^0.6.3", "grunt-cli": "^1.3.2", @@ -64,6 +66,7 @@ "grunt-newer": "^1.3.0", "grunt-postcss": "^0.8.0", "grunt-serve": "^0.1.6", + "grunt-shell": "^3.0.1", "grunt-uncss": "^0.8.6", "handlebars": "^4.7.6", "husky": "^0.14.3", From 32afc773b9ea8490ebb40e42815a4e4a0757dca4 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Fri, 7 Aug 2020 17:55:02 +0200 Subject: [PATCH 005/158] Create automated_reference_update.md --- .../automated_reference_update.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 contributor_docs/automated_reference_update.md diff --git a/contributor_docs/automated_reference_update.md b/contributor_docs/automated_reference_update.md new file mode 100644 index 0000000000..602b8de35f --- /dev/null +++ b/contributor_docs/automated_reference_update.md @@ -0,0 +1,21 @@ +##Automated Reference update + +The p5.js documentation needs to be updated every time a new p5.js release gets published. +This process is done by the `update-enJSON` [grunt task](https://github.com/processing/p5.js-website/blob/main/Gruntfile.js). +The task: +- clones the p5.js repository in a tmp folder +- generates the updated data.json file with the command `npm run grunt yui` +- commits the data.json in the p5.js-website repository +- generates the updated en.json with the getenJSON() function +- commits the en.json in the p5.js-website repository +- deletes the tmp folder + +This task is run by a GitHub workflow in the p5.js-website repository that [gets triggered by another workflow](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch) in the p5.js repository. + +Every time a new p5.js release gets published, workflow1 (in the p5.js repository) gets triggered and in turn triggers workflow2 (in the p5.js-website repository) that runs the `update-enJSON` task. + +When workflow2 commits the updated Reference files, the commit message will show both the p5.js release tag and the commit's sha. + +###Notes: +- For the repository_dispatch event of workflow1, [this GitHub action](https://github.com/peter-evans/repository-dispatch) was used. +- In order for the workflow1 to trigger workflow2, **it requires a repo scoped Personal Access Token created on a user with write access to the p5.js-website repository**. The Personal Access Token needs to be stored as secret in the p5.js repository. From ec61d311a2535be9125cc9d454fe7cad0f05636b Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Sun, 9 Aug 2020 00:58:44 +0200 Subject: [PATCH 006/158] Add workflows names to documentation --- contributor_docs/automated_reference_update.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contributor_docs/automated_reference_update.md b/contributor_docs/automated_reference_update.md index 602b8de35f..f9eceae8bb 100644 --- a/contributor_docs/automated_reference_update.md +++ b/contributor_docs/automated_reference_update.md @@ -12,10 +12,10 @@ The task: This task is run by a GitHub workflow in the p5.js-website repository that [gets triggered by another workflow](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch) in the p5.js repository. -Every time a new p5.js release gets published, workflow1 (in the p5.js repository) gets triggered and in turn triggers workflow2 (in the p5.js-website repository) that runs the `update-enJSON` task. +Every time a new p5.js release gets published, the update-p5jswebsite workflow (in the p5.js repository) gets triggered and in turn triggers the update-documentation workflow (in the p5.js-website repository) that runs the `update-enJSON` task. -When workflow2 commits the updated Reference files, the commit message will show both the p5.js release tag and the commit's sha. +When the update-documentation workflow commits the updated Reference files, the commit message will show both the p5.js release tag and the commit's sha. ###Notes: -- For the repository_dispatch event of workflow1, [this GitHub action](https://github.com/peter-evans/repository-dispatch) was used. -- In order for the workflow1 to trigger workflow2, **it requires a repo scoped Personal Access Token created on a user with write access to the p5.js-website repository**. The Personal Access Token needs to be stored as secret in the p5.js repository. +- For the repository_dispatch event of the update-p5jswebsite workflow, [this GitHub action](https://github.com/peter-evans/repository-dispatch) was used. +- In order for the update-p5jswebsite workflow to trigger the update-documentation workflow, **it requires a repo scoped Personal Access Token created on a user with write access to the p5.js-website repository**. The Personal Access Token needs to be stored as secret in the p5.js repository. From 7d58bc7a75c4367b62b3d8bab35007bcc4262b80 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Fri, 7 Aug 2020 10:53:50 +0200 Subject: [PATCH 007/158] Add Grunt tasks Grunt task that clone the p5.js repo, generate the data.json, move it in the p5.js-website repo, and finally generate the en.json. --- Gruntfile.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 304a0029bd..1a1b8dff1c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,6 +8,7 @@ const yaml = require('js-yaml'); const fs = require('fs').promises; +const fse = require('fs-extra'); const pkg = require('./package.json'); module.exports = function(grunt) { @@ -351,6 +352,27 @@ module.exports = function(grunt) { ] } } + }, + shell: { + make_tmp_dir: { + command: 'mkdir -p tmp/p5.js' + }, + clone_p5js_repo: { + command: 'git clone https://github.com/processing/p5.js .', + options: { + execOptions: { + cwd: 'tmp/p5.js' + } + } + }, + generate_dataJSON: { + command: 'npm i && npm run grunt yui', + options: { + execOptions: { + cwd: 'tmp/p5.js' + } + } + } } }); @@ -378,6 +400,35 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-html'); + grunt.registerTask('clone_p5js', [ + 'shell:make_tmp_dir', + 'shell:clone_p5js_repo' + ]); + + grunt.registerTask('generate_dataJSON', ['shell:generate_dataJSON']); + + grunt.registerTask('move_dataJSON', function() { + const dataJSON_p5js = 'tmp/p5.js/docs/reference/data.json'; + const dataJSON_p5jswebsite = 'src/templates/pages/reference/data.json'; + // move the data.json from the cloned p5.js repository to the p5.js-website repository + fse.moveSync(dataJSON_p5js, dataJSON_p5jswebsite, { overwrite: true }); + // delete the tmp folder that contained the p5.js repository + fse.removeSync('tmp/'); + }); + + grunt.registerTask('generate_enJSON', function() { + const getenJSON = require('./getenJSON.js'); + // generate and save the en.json + getenJSON(); + }); + + grunt.registerTask('update-enJSON', [ + 'clone_p5js', + 'generate_dataJSON', + 'move_dataJSON', + 'generate_enJSON' + ]); + // multi-tasks: collections of other tasks grunt.registerTask('server', [ 'build', From e9307dfa321885ac4ab8aa13c62e89d637c28253 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Fri, 7 Aug 2020 11:00:36 +0200 Subject: [PATCH 008/158] Create config file for update-documentation workflow Workflows that updates both the data.json file and the en.json everytime a new p5.js release gets published. --- .github/workflows/update-documentation.yml | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/update-documentation.yml diff --git a/.github/workflows/update-documentation.yml b/.github/workflows/update-documentation.yml new file mode 100644 index 0000000000..ada2b31dd1 --- /dev/null +++ b/.github/workflows/update-documentation.yml @@ -0,0 +1,37 @@ +name: Update p5.js documentation + +on: + # This workflow is triggered by the p5.js repo on every new release. + repository_dispatch +env: + # These are the tag name and the commit sha of the p5.js release. + P5JS_REF: ${{github.event.client_payload.ref}} + P5JS_SHA: ${{github.event.client_payload.sha}} + +jobs: + build: + name: Update p5.js documentation + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v1 + - name: Install Node.JS 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Extract documentation from the p5.js repo + run: | + npm install + npm run grunt update-enJSON + - name: Get p5.js release info + id: p5js + run: | + echo ::set-output name=VERSION::${P5JS_REF/refs\/tags\//} + echo ::set-output name=SHA::${P5JS_SHA} + - name: Commit changes + uses: EndBug/add-and-commit@v4 + with: + message: 'Update reference files for p5.js ${{ steps.p5js.outputs.VERSION }} release (${{ steps.p5js.outputs.SHA }})' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From bd767842f138f87617cabc9d84202f0cd2a81337 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Fri, 7 Aug 2020 11:40:41 +0200 Subject: [PATCH 009/158] Update package-lock.json --- package-lock.json | 109 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 645510e6b6..45fea56cde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1259,6 +1259,12 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true + }, "atob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", @@ -6937,6 +6943,26 @@ "integrity": "sha1-mC1ok6+RjnLQjeyehnP/K1qNat0=", "dev": true }, + "fs-extra": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", + "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^1.0.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true + } + } + }, "fs-utils": { "version": "0.3.10", "resolved": "https://registry.npmjs.org/fs-utils/-/fs-utils-0.3.10.tgz", @@ -8364,6 +8390,69 @@ } } }, + "grunt-shell": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/grunt-shell/-/grunt-shell-3.0.1.tgz", + "integrity": "sha512-C8eR4frw/NmIFIwSvzSLS4wOQBUzC+z6QhrKPzwt/tlaIqlzH35i/O2MggVOBj2Sh1tbaAqpASWxGiGsi4JMIQ==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "npm-run-path": "^2.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "grunt-uncss": { "version": "0.8.6", "resolved": "https://registry.npmjs.org/grunt-uncss/-/grunt-uncss-0.8.6.tgz", @@ -10203,6 +10292,16 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, + "jsonfile": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", + "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^1.0.0" + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -13060,7 +13159,6 @@ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, - "optional": true, "requires": { "path-key": "^2.0.0" } @@ -13730,8 +13828,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true, - "optional": true + "dev": true }, "path-parse": { "version": "1.0.6", @@ -19702,6 +19799,12 @@ } } }, + "universalify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", + "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", + "dev": true + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", From ad7d31a08190a06c8b58858cf2e3281088c9cc35 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Fri, 7 Aug 2020 11:42:10 +0200 Subject: [PATCH 010/158] Update package.json --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 4751eda749..d2e734ef3d 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "node": ">=0.10" }, "scripts": { + "grunt": "grunt", "assemble": "grunt assemble", "build": "grunt build", "test": "grunt build", @@ -46,6 +47,7 @@ "eslint": "^4.19.1", "eslint-config-prettier": "^2.10.0", "eslint-plugin-prettier": "^2.7.0", + "fs-extra": "^9.0.1", "grunt": "^1.1.0", "grunt-assemble": "^0.6.3", "grunt-cli": "^1.3.2", @@ -64,6 +66,7 @@ "grunt-newer": "^1.3.0", "grunt-postcss": "^0.8.0", "grunt-serve": "^0.1.6", + "grunt-shell": "^3.0.1", "grunt-uncss": "^0.8.6", "handlebars": "^4.7.6", "husky": "^0.14.3", From 2ba16fd508e06d9082fd6e6fe98b74cc3fe46041 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Fri, 7 Aug 2020 17:55:02 +0200 Subject: [PATCH 011/158] Create automated_reference_update.md --- .../automated_reference_update.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 contributor_docs/automated_reference_update.md diff --git a/contributor_docs/automated_reference_update.md b/contributor_docs/automated_reference_update.md new file mode 100644 index 0000000000..602b8de35f --- /dev/null +++ b/contributor_docs/automated_reference_update.md @@ -0,0 +1,21 @@ +##Automated Reference update + +The p5.js documentation needs to be updated every time a new p5.js release gets published. +This process is done by the `update-enJSON` [grunt task](https://github.com/processing/p5.js-website/blob/main/Gruntfile.js). +The task: +- clones the p5.js repository in a tmp folder +- generates the updated data.json file with the command `npm run grunt yui` +- commits the data.json in the p5.js-website repository +- generates the updated en.json with the getenJSON() function +- commits the en.json in the p5.js-website repository +- deletes the tmp folder + +This task is run by a GitHub workflow in the p5.js-website repository that [gets triggered by another workflow](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch) in the p5.js repository. + +Every time a new p5.js release gets published, workflow1 (in the p5.js repository) gets triggered and in turn triggers workflow2 (in the p5.js-website repository) that runs the `update-enJSON` task. + +When workflow2 commits the updated Reference files, the commit message will show both the p5.js release tag and the commit's sha. + +###Notes: +- For the repository_dispatch event of workflow1, [this GitHub action](https://github.com/peter-evans/repository-dispatch) was used. +- In order for the workflow1 to trigger workflow2, **it requires a repo scoped Personal Access Token created on a user with write access to the p5.js-website repository**. The Personal Access Token needs to be stored as secret in the p5.js repository. From 1ebc12e892f939fc0e2ffbddd600b731cd7ac596 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Sun, 9 Aug 2020 00:58:44 +0200 Subject: [PATCH 012/158] Add workflows names to documentation --- contributor_docs/automated_reference_update.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contributor_docs/automated_reference_update.md b/contributor_docs/automated_reference_update.md index 602b8de35f..f9eceae8bb 100644 --- a/contributor_docs/automated_reference_update.md +++ b/contributor_docs/automated_reference_update.md @@ -12,10 +12,10 @@ The task: This task is run by a GitHub workflow in the p5.js-website repository that [gets triggered by another workflow](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch) in the p5.js repository. -Every time a new p5.js release gets published, workflow1 (in the p5.js repository) gets triggered and in turn triggers workflow2 (in the p5.js-website repository) that runs the `update-enJSON` task. +Every time a new p5.js release gets published, the update-p5jswebsite workflow (in the p5.js repository) gets triggered and in turn triggers the update-documentation workflow (in the p5.js-website repository) that runs the `update-enJSON` task. -When workflow2 commits the updated Reference files, the commit message will show both the p5.js release tag and the commit's sha. +When the update-documentation workflow commits the updated Reference files, the commit message will show both the p5.js release tag and the commit's sha. ###Notes: -- For the repository_dispatch event of workflow1, [this GitHub action](https://github.com/peter-evans/repository-dispatch) was used. -- In order for the workflow1 to trigger workflow2, **it requires a repo scoped Personal Access Token created on a user with write access to the p5.js-website repository**. The Personal Access Token needs to be stored as secret in the p5.js repository. +- For the repository_dispatch event of the update-p5jswebsite workflow, [this GitHub action](https://github.com/peter-evans/repository-dispatch) was used. +- In order for the update-p5jswebsite workflow to trigger the update-documentation workflow, **it requires a repo scoped Personal Access Token created on a user with write access to the p5.js-website repository**. The Personal Access Token needs to be stored as secret in the p5.js repository. From 0ba4cee62124b7d9b5df6d7c9d11d727bda813fa Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Tue, 18 Aug 2020 01:24:52 +0200 Subject: [PATCH 013/158] Fix "UNKNOWN-PARAM" keys and delete empty strings --- src/data/reference/zh-Hans.json | 768 +++++++++++--------------------- 1 file changed, 261 insertions(+), 507 deletions(-) diff --git a/src/data/reference/zh-Hans.json b/src/data/reference/zh-Hans.json index 75315cdc51..1f6be941f8 100644 --- a/src/data/reference/zh-Hans.json +++ b/src/data/reference/zh-Hans.json @@ -89,14 +89,14 @@ "创造颜色物件并将其存放在颜色变量内。依当时的颜色模式而定,参数可被解读成 RGB 或 HSB 值。默认模式为 RGB 值从 0 至 255,因此调用函数 color(255, 204, 0) 将返回亮黄色。

请注意如果 color() 值被提供一个参数,它将被解读成灰阶值;增加多一个参数,它将被用来定义透明度。当被提供三个参数时,它们将被解读成 RGB 或 HSB 值;增加第四个参数将定义透明度。

如果只提供单一字符串参数,RGB、RGBA 和 十六进制 CSS 颜色字符串都为受支持的模式。在这情况下,提供第二个参数以定义透明度值并不被支持,而需使用 RGBA 字符串。" ], "params": { - "v1": "数字:一个定义白与黑之间的数值", - "v2": "数字:透明度值,需在被定义的范围内(默认为 0 至 255)", - "v3": "数字:红彩值或色调值,需在被定义的范围内", - "alpha": "数字:绿彩值或饱和度值,需在被定义的范围内", - "UNKNOWN-PARAM-5": "数字:蓝彩值或亮度值,需在被定义的范围内", - "UNKNOWN-PARAM-6": "字符串:颜色字符串", - "UNKNOWN-PARAM-7": "数字[]:一个有红、绿、蓝及透明度值的数组", - "UNKNOWN-PARAM-8": "p5.Color:" + "gray": "数字:一个定义白与黑之间的数值", + "alpha": "数字:透明度值,需在被定义的范围内(默认为 0 至 255)", + "v1": "数字:红彩值或色调值,需在被定义的范围内", + "v2": "数字:绿彩值或饱和度值,需在被定义的范围内", + "v3": "数字:蓝彩值或亮度值,需在被定义的范围内", + "value": "字符串:颜色字符串", + "values": "数字[]:一个有红、绿、蓝及透明度值的数组", + "color": "p5.Color:" }, "returns": "p5.Color:返回的颜色" }, @@ -155,23 +155,21 @@ "background() 函数设定 p5.js 画布的背景颜色。默认背景颜色为浅灰色。这函数通常用在 draw() 函数内以在各画面开始时清空画布,不过它也能在 setup() 内使用以定义第一个画面的背景颜色或当背景颜色只需要被定义一次时。

背景颜色可用 RGB、HSB 或 HSL 颜色定义,取决于当时的颜色模式(默认色彩空间是 RGB,而每个数值都介于 0 至 255 之间)。默认透明度值也介于 0 至 255 之间。

如果所提供的参数是单一字符串,RGB、RGBA 和十六进制 CSS 颜色字符串及所有命名颜色都可以使用。在这情况下,提供第二个参数以定义透明度值并不被支持,而需使用 RGBA 字符串。

p5.Color 物件也能被用来定义背景颜色。

p5.Image 也能被用来提供背景图像。" ], "params": { - "v1": "p5.Color:任何使用 color() 函数创造的颜色", - "v2": "字符串:颜色字符串,可接受的格式包括:整数 rgb() 或 rgba()、百分率 rgb() 或 rgba()、3 位十六进制、6 位十六进制", - "v3": "数字:透明度值,需在被定义的范围内(默认为 0 至 255)", - "a": "数字:一个定义白与黑之间的数值", - "UNKNOWN-PARAM-5": "数字:红彩值或色调值(取决于当时的颜色模式)", - "UNKNOWN-PARAM-6": "数字:绿彩值或饱和度值(取决于当时的颜色模式)", - "UNKNOWN-PARAM-7": "数字:蓝彩值或亮度值(取决于当时的颜色模式)", - "UNKNOWN-PARAM-8": "数字[]:一个有红、绿、蓝及透明度值的数组", - "UNKNOWN-PARAM-9": "p5.Image:一个使用 loadImage() 或 createImage() 创造的图像,用以设定背景图像(必须和画布有相同的大小)" - }, - "returns": "" + "color": "p5.Color:任何使用 color() 函数创造的颜色", + "colorstring": "字符串:颜色字符串,可接受的格式包括:整数 rgb() 或 rgba()、百分率 rgb() 或 rgba()、3 位十六进制、6 位十六进制", + "a": "数字:透明度值,需在被定义的范围内(默认为 0 至 255)", + "gray": "数字:一个定义白与黑之间的数值", + "v1": "数字:红彩值或色调值(取决于当时的颜色模式)", + "v2": "数字:绿彩值或饱和度值(取决于当时的颜色模式)", + "v3": "数字:蓝彩值或亮度值(取决于当时的颜色模式)", + "values": "数字[]:一个有红、绿、蓝及透明度值的数组", + "image": "p5.Image:一个使用 loadImage() 或 createImage() 创造的图像,用以设定背景图像(必须和画布有相同的大小)" + } }, "clear": { "description": [ "清除图形缓冲区内的像素。这函数只能用于使用 createCanvas() 函数创造的 p5.Canvas 物件,而不能用于主要的显示窗口。使用 createGraphics() 创造的图形缓冲并不像主要的图形缓冲,它们能是完全透明或半透明的。这函数将清空所有东西使每个像素都是 100% 透明。" - ], - "returns": "" + ] }, "colorMode": { "description": [ @@ -179,13 +177,12 @@ ], "params": { "mode": "常量: RGB、HSB 或 HSL,分别代表红绿蓝及色调/饱和度/亮度(或光度)", - "max1": "数字:所有数值的最大值", - "max2": "数字:红色值或色调值的最大值,取决于当时的颜色模式", - "max3": "数字:绿色值或饱和度值的最大值,取决于当时的颜色模式", - "maxA": "数字:蓝色值或亮度/光度值的最大值,取决于当时的颜色模式", - "UNKNOWN-PARAM-6": "数字:透明度值的最大值" - }, - "returns": "" + "max": "数字:所有数值的最大值", + "max1": "数字:红色值或色调值的最大值,取决于当时的颜色模式", + "max2": "数字:绿色值或饱和度值的最大值,取决于当时的颜色模式", + "max3": "数字:蓝色值或亮度/光度值的最大值,取决于当时的颜色模式", + "maxA": "数字:透明度值的最大值" + } }, "fill": { "description": [ @@ -196,24 +193,21 @@ "v2": "数字:绿彩值或饱和度值,需在被定义的范围内", "v3": "数字:蓝彩值或亮度值,需在被定义的范围内", "alpha": "数字:", - "UNKNOWN-PARAM-5": "字符串:颜色字符串", - "UNKNOWN-PARAM-6": "数字:灰阶值", - "UNKNOWN-PARAM-7": "数字[]:一个有红、绿、蓝及透明度值的数组", - "UNKNOWN-PARAM-8": "p5.Color:填充色" - }, - "returns": "" + "value": "字符串:颜色字符串", + "gray": "数字:灰阶值", + "values": "数字[]:一个有红、绿、蓝及透明度值的数组", + "color": "p5.Color:填充色" + } }, "noFill": { "description": [ "禁用形状填充。如果 noStroke() 和 noFill() 都被调用的话,没有形状会被画在荧幕上。" - ], - "returns": "" + ] }, "noStroke": { "description": [ "禁用形状外线。如果 noStroke() 和 noFill() 都被调用的话,没有形状会被画在荧幕上。" - ], - "returns": "" + ] }, "stroke": { "description": [ @@ -224,12 +218,11 @@ "v2": "数字:绿彩值或饱和度值,需在被定义的范围内", "v3": "数字:蓝彩值或亮度值,需在被定义的范围内", "alpha": "数字:", - "UNKNOWN-PARAM-5": "字符串:颜色字符串", - "UNKNOWN-PARAM-6": "数字:灰阶值", - "UNKNOWN-PARAM-7": "数字[]:一个有红、绿、蓝及透明度值的数组", - "UNKNOWN-PARAM-8": "p5.Color:外形线色" - }, - "returns": "" + "value": "字符串:颜色字符串", + "gray": "数字:灰阶值", + "values": "数字[]:一个有红、绿、蓝及透明度值的数组", + "color": "p5.Color:外形线色" + } }, "arc": { "description": [ @@ -243,8 +236,7 @@ "start": "数字:弧形开始的角度,用弧度定义", "stop": "数字:弧形结束的角度,用弧度定义", "mode": "常数:可选参数用以定义弧形的画法,可用 CHORD、PIE 或 OPEN" - }, - "returns": "" + } }, "ellipse": { "description": [ @@ -256,8 +248,7 @@ "w": "数字:椭圆形的宽度", "h": "数字:椭圆形的高度", "detail": "整数:椭圆形的径向扇区数" - }, - "returns": "" + } }, "line": { "description": [ @@ -270,8 +261,7 @@ "x2": "数字:第二个点的 y 坐标", "y2": "数字:第一个点的 z 坐标", "z2": "数字:第二个点的 z 坐标" - }, - "returns": "" + } }, "point": { "description": [ @@ -281,8 +271,7 @@ "x": "数字:x 坐标", "y": "数字:y 坐标", "z": "数字:z 坐标(用于 WEBGL 模式" - }, - "returns": "" + } }, "quad": { "description": [ @@ -301,8 +290,7 @@ "x4": "数字:", "y4": "数字:", "z4": "数字:" - }, - "returns": "" + } }, "rect": { "description": [ @@ -317,10 +305,9 @@ "tr": "数字:可选性右上角拐角半径值", "br": "数字:可选性右下角拐角半径值", "bl": "数字:可选性左下角拐角半径值", - "UNKNOWN-PARAM-9": "整数:x 方向段数", - "UNKNOWN-PARAM-10": "整数:y 方向段数" - }, - "returns": "" + "detailX": "整数:x 方向段数", + "detailY": "整数:y 方向段数" + } }, "triangle": { "description": [ @@ -333,8 +320,7 @@ "y2": "数字:第二个点的 y 坐标", "x3": "数字:第三个点的 x 坐标", "y3": "数字:第三个点的 y 坐标" - }, - "returns": "" + } }, "ellipseMode": { "description": [ @@ -342,14 +328,12 @@ ], "params": { "mode": "常量:CENTER、RADIUS、CORNER 或 CORNERS" - }, - "returns": "" + } }, "noSmooth": { "description": [ "所有形状的边缘都为锯齿状。注意 smooth() 为默认模式所以您必须调用 noSmooth() 以禁用平滑形状、图像及字体。" - ], - "returns": "" + ] }, "rectMode": { "description": [ @@ -357,14 +341,12 @@ ], "params": { "mode": "常量:CORNER、CORNERS、CENTER 或 RADIUS" - }, - "returns": "" + } }, "smooth": { "description": [ "所有形状的边缘都为非锯齿(平滑)状。smooth() 也将提高调整过大小的图像的素质。注意 smooth() 为默认模式;noSmooth() 也能用来禁用平滑形状、图像及字体。" - ], - "returns": "" + ] }, "strokeCap": { "description": [ @@ -372,8 +354,7 @@ ], "params": { "cap": "常量:SQUARE、PROJECT 或 ROUND" - }, - "returns": "" + } }, "strokeJoin": { "description": [ @@ -381,8 +362,7 @@ ], "params": { "join": "常量:MITER、BEVEL 或 ROUND" - }, - "returns": "" + } }, "strokeWeight": { "description": [ @@ -390,8 +370,7 @@ ], "params": { "weight": "数字:线条的粗度(像素单位)" - }, - "returns": "" + } }, "bezier": { "description": [ @@ -410,8 +389,7 @@ "x4": "数字:第一个控制点的 z 坐标", "y4": "数字:第二个锚点的 z 坐标", "z4": "数字:第二个控制点的 z 坐标" - }, - "returns": "" + } }, "bezierDetail": { "description": [ @@ -419,8 +397,7 @@ ], "params": { "detail": "数字:曲线的解析度" - }, - "returns": "" + } }, "bezierPoint": { "description": [ @@ -465,8 +442,7 @@ "x4": "数字:第一个点的 z 坐标", "y4": "数字:第二个点的 z 坐标", "z4": "数字:终点控制点的 z 坐标" - }, - "returns": "" + } }, "curveDetail": { "description": [ @@ -474,8 +450,7 @@ ], "params": { "resolution": "数字:曲线的解析度" - }, - "returns": "" + } }, "curveTightness": { "description": [ @@ -483,8 +458,7 @@ ], "params": { "amount": "数字:从原顶点的变形量" - }, - "returns": "" + } }, "curvePoint": { "description": [ @@ -515,8 +489,7 @@ "beginContour": { "description": [ "使用 beginContour() 及 endContour() 函数以在其他形状内创造剪影形状,比如说 “O” 字母内的空间。beginContour() 将开始记录形状的顶点而 endContour() 则停止记录。定义剪影形状的顶点定义的方向(顺时或逆时针)必须和包含它的形状不同。如果外形的顶点是顺时针方向定义的,那么它里面的形状的顶点需是逆时针方向定义。

这些函数只能在一对 beginShape()/endShape() 函数之间使用而变形函数如 translate()、rotate() 及 scale() 在一对 beginContour()/endContour() 内并不会有任何效果。其他形状如 ellipse() 或 rect() 也不能在里面使用。" - ], - "returns": "" + ] }, "beginShape": { "description": [ @@ -524,8 +497,7 @@ ], "params": { "kind": "常量:POINTS、LINES、TRIANGLES、TRIANGLE_FAN、TRIANGLE_STRIP、QUADS 或 QUAD_STRIP" - }, - "returns": "" + } }, "bezierVertex": { "description": [ @@ -538,8 +510,7 @@ "y3": "数字:第二个控制点的 y 坐标", "x4": "数字:第一个锚点的 x 坐标", "y4": "数字:第二个锚点的 x 坐标" - }, - "returns": "" + } }, "curveVertex": { "description": [ @@ -548,14 +519,12 @@ "params": { "x": "数字:顶点的 x 坐标", "y": "数字:顶点的 y 坐标" - }, - "returns": "" + } }, "endContour": { "description": [ "使用 beginContour() 及 endContour() 函数以在其他形状内创造剪影形状,比如说 “O” 字母内的空间。beginContour() 将开始记录形状的顶点而 endContour() 则停止记录。定义剪影形状的顶点定义的方向(顺时或逆时针)必须和包含它的形状不同。如果外形的顶点是顺时针方向定义的,那么它里面的形状的顶点需是逆时针方向定义。

这些函数只能在一对 beginShape()/endShape() 函数之间使用而变形函数如 translate()、rotate() 及 scale() 在一对 beginContour()/endContour() 内并不会有任何效果。其他形状如 ellipse() 或 rect() 也不能在里面使用。" - ], - "returns": "" + ] }, "endShape": { "description": [ @@ -563,8 +532,7 @@ ], "params": { "mode": "常量:使用 CLOSE 以关闭形状" - }, - "returns": "" + } }, "quadraticVertex": { "description": [ @@ -575,8 +543,7 @@ "cy": "数字:控制点的 y 坐标", "x3": "数字:锚点的 x 坐标", "y3": "数字:锚点的 y 坐标" - }, - "returns": "" + } }, "vertex": { "description": [ @@ -588,8 +555,7 @@ "z": "数字:顶点的 z 坐标", "u": "数字:顶点的纹理 u 坐标", "v": "数字:顶点的纹理 v 坐标" - }, - "returns": "" + } }, "loadModel": { "description": [ @@ -607,8 +573,7 @@ "description": ["将一个三维模型渲染在荧幕上。"], "params": { "model": "p5.Geometry:要渲染的已加载的模型" - }, - "returns": "" + } }, "plane": { "description": ["用给予的宽度和高度画一个平面。"], @@ -617,8 +582,7 @@ "height": "数字:平面的高度", "detailX": "整数:(可选)在 x 轴的三角形细分数", "detailY": "整数:(可选)在 y 轴的三角形细分数" - }, - "returns": "" + } }, "box": { "description": ["用给予的宽度、高度及深度画一个立方体。"], @@ -628,8 +592,7 @@ "depth": "数字:立方体的深度", "detailX": "整数:(可选)在 x 轴的三角形细分数", "detailY": "整数:(可选)在 y 轴的三角形细分数" - }, - "returns": "" + } }, "sphere": { "description": ["用给予的半径画一个球形。"], @@ -637,8 +600,7 @@ "radius": "数字:球形的半径", "detailX": "整数:分割的数量,越多分割几何形越平滑,默认值为 24", "detailY": "整数:分割的数量,越多分割几何形越平滑,默认值为 16" - }, - "returns": "" + } }, "cylinder": { "description": ["用给予的半径和高度画一个圆筒形。"], @@ -649,8 +611,7 @@ "detailY": "整数:y 轴分割的数量,越多分割几何形越平滑,默认值为 1", "bottomCap": "布尔值:是否该画圆筒形的底部", "topCap": "布尔值:是否该画圆筒形的顶部" - }, - "returns": "" + } }, "cone": { "description": ["用给予的半径和高度画一个锥体形。"], @@ -660,8 +621,7 @@ "detailX": "整数:分割的数量,越多分割几何形越平滑,默认值为 24", "detailY": "整数:分割的数量,越多分割几何形越平滑,默认值为 1", "cap": "布尔值:是否该画锥体形的底部" - }, - "returns": "" + } }, "ellipsoid": { "description": ["用给予的半径画一个椭球形。"], @@ -671,8 +631,7 @@ "radiusz": "数字:椭球形 z 轴的半径", "detailX": "整数:分割的数量,越多分割几何形越平滑,默认值为 24。避免多于 150 的细节数量,因为它可能是浏览器停止运作。", "detailY": "整数:分割的数量,越多分割几何形越平滑,默认值为 16。避免多于 150 的细节数量,因为它可能是浏览器停止运作。" - }, - "returns": "" + } }, "torus": { "description": ["用给予的半径和管半径画一个圆环形。"], @@ -681,92 +640,77 @@ "tubeRadius": "数字:圆管的半径", "detailX": "整数:x 轴分割的数量,越多分割几何形越平滑,默认值为 24。", "detailY": "整数:y 轴分割的数量,越多分割几何形越平滑,默认值为 16。" - }, - "returns": "" + } }, "HALF_PI": { "description": [ "HALF_PI 是个值为 1.57079632679489661923 的数学常量。它是圆形周长与直径的比例的一半。它能有效的与三角函数如 sin() 及 cos() 一起使用。" - ], - "returns": "" + ] }, "PI": { "description": [ "PI 是个值为 3.14159265358979323846 的数学常量。它是圆形周长与直径的比例。它能有效的与三角函数如 sin() 及 cos() 一起使用。" - ], - "returns": "" + ] }, "QUARTER_PI": { "description": [ "QUARTER_PI 是个值为 0.7853982 的数学常量。它是圆形周长与直径的比例的四分之一。它能有效的与三角函数如 sin() 及 cos() 一起使用。" - ], - "returns": "" + ] }, "TAU": { "description": [ "TAU 是 TWO_PI 的别名,是个值为 6.28318530717958647693 的数学常量。它是圆形周长与直径的比例的两倍。它能有效的与三角函数如 sin() 及 cos() 一起使用。" - ], - "returns": "" + ] }, "TWO_PI": { "description": [ "TWO_PI 是个值为 6.28318530717958647693 的数学常量。它是圆形周长与直径的比例的两倍。它能有效的与三角函数如 sin() 及 cos() 一起使用。" - ], - "returns": "" + ] }, "DEGREES": { "description": [ "与 angleMode() 函数一起使用的常量,用于设定 p5.js 如何解读及计算角度(可以是 DEGREES 或 RADIANS)。" - ], - "returns": "" + ] }, "RADIANS": { "description": [ "与 angleMode() 函数一起使用的常量,用于设定 p5.js 如何解读及计算角度(可以是 DEGREES 或 RADIANS)。" - ], - "returns": "" + ] }, "preload": { "description": [ "在 setup() 之前被调用,preload() 函数可用来以阻断的方式处理异步加载外来文件。如果 preload 函数有被定义,setup() 将等到其中的加载工作都完成后才开始执行。preload 函数只能含有加载函数(如 loadImage、loadJSON、loadFont、loadStrings 等)。如果您想使用异步加载,加载函数可在 setup() 内或任何其他地方调用,您只需使用其回调函数参数。

在默认情况下 “loading...” 字眼将会被显示。如果您想只做您自己的加载页面,只需在您也页面上加个 id 为 “p5_loading” 的 HTML 元素。更多详情请查看这里。" - ], - "returns": "" + ] }, "setup": { "description": [ "setup() 函数将在程式开始时被调用一次。它可在程序开始时被用来定义初始的环境属性如荧幕大小、背景颜色及媒体加载如图像及字体。每个程序只能有一个 setup() 函数并且他不能在一开始执行后再次被调用。

请注意:在 setup() 内定义的变量并不能在其他函数内使用,这包括 draw() 。" - ], - "returns": "" + ] }, "draw": { "description": [ "在 setup() 之后被调用,draw() 函数将持续地重复执行其中的代码直到该程式终止或当 noLoop() 被调用。注意如果 noLoop() 在 setup() 内被调用,draw() 仍然会被执行一个然后才停止。draw() 将会自动被调用并不应该被直接调用。

您应该使用 noLoop()、redraw() 及 loop() 来控制它。当 noLoop() 停止执行 draw() 内的代码,redraw() 会使 draw() 内的代码执行一次,而 loop() 将会使 draw() 内的代码继续重复执行。

每一秒 draw() 执行的次数可使用 frameRate() 函数来控制。

每个绘图只能有一个 draw() 函数,而如果您想持续重复执行代码或处理事件如 mousePressed(),draw() 必须存在。有时候您的程式可能会有空白的 draw() 函数,如以上的范例所示。

请特别注意绘图坐标系统将在每次 draw() 在开始被调用时重置。任何在 draw() 内执行的变形指令(如 scale、rotate、translate)将会在下一个 draw() 开始时复原,所以变形指令并不会随着时间积累。另一方面,样式(如 fill、stroke等)将会持续同样的效果。" - ], - "returns": "" + ] }, "remove": { "description": [ "移除整个 p5 绘图。这函数将移除画布及任何由 p5.js 创造的元素。它也会终止绘图循环及解除任何被绑定在窗口对象的属性或函数。它会留下一个 p5 变量以防您还想创造一个新的 p5 绘图。您也可以舍去 p5 = null 以完全删除它。虽然所有由 p5 程式库所创造的函数、变量和物件将会被移除,任何其他由您的代码所定义的公共变量将会被保留。" - ], - "returns": "" + ] }, "noLoop": { "description": [ "停止 p5.js 持续重复执行 draw() 内的代码。如果 loop() 被调用,draw() 内的代码将开始继续重复执行。如果 noLoop() 在 setup() 被调用,它应该是代码块的最后一行代码。

在使用 noLoop() 时,您并不能在事件处理函数如 mousePressed() 或 keyPressed() 内操纵或存取荧幕。不过您可以使用哪些函数调用 redraw() 或 loop(),从而执行 draw(),以正确的更新荧幕。这表示当 noLoop() 被调用后,您不能绘制任何东西,同时某些函数如 saveFrame() 或 loadPixels() 也不能使用。

注意如果绘图的大小改变,redraw() 将会被调用以更新绘图,即使 noLoop() 已经被调用,不然绘图将会处于一个奇怪的状态直到 loop() 再次被调用。" - ], - "returns": "" + ] }, "loop": { "description": [ "在默认下,p5.js 将会循环执行 draw() 内的代码。不过 draw() 循环能使用 noLoop() 停止。在这情况下 draw() 循环可使用 loop() 函数恢复执行。" - ], - "returns": "" + ] }, "push": { "description": [ "push() 函数将储存当时的绘画样式设置及变形,而 pop() 将恢复这些设置。注意这两个函数需要一起使用。它们让您改变样式及变形设置然后再回到您之前的设置。当使用 push() 开始一个新的状态时,它将继续建立在当时的样式和变形上。push() 和 pop() 函数可被重复嵌入以提供更复杂的控制。(请参考第二个范例)

push() 将现有的变形及样式设置资料储存上来,这包括以下的函数:fill()、stroke()、tint()、strokeWeight()、strokeCap()、strokeJoin()、imageMode()、rectMode()、ellipseMode()、colorMode()、textAlign()、textFont()、textMode()、textSize()、textLeading()。" - ], - "returns": "" + ] }, "pop": { "description": [ @@ -779,8 +723,7 @@ ], "params": { "n": "整数:重绘 n 次。默认值为 1" - }, - "returns": "" + } }, "print": { "description": [ @@ -788,20 +731,17 @@ ], "params": { "contents": "任何:任何要写进控制台的数字、字符串、物件、布尔值或数组的组合" - }, - "returns": "" + } }, "frameCount": { "description": [ "系统变量 frameCount 存着自程序开始已被展示的影格数量。在 setup() 这值为 0,在第一次执行 draw() 后为 1 等等。" - ], - "returns": "" + ] }, "focused": { "description": [ "确定 p5.js 程式正在运行的窗口是否获得“焦点”,这表示绘图可接受滑鼠或键盘输入。如果窗口获得焦点,次变量为 “true” 否则为 “false”。" - ], - "returns": "" + ] }, "cursor": { "description": [ @@ -811,8 +751,7 @@ "type": "字符串|常量:ARROW、CROSS、HAND、MOVE、TEXT 或图像的路径", "x": "数字:鼠标的横向活跃点", "y": "数字:鼠标的直向活跃点" - }, - "returns": "" + } }, "frameRate": { "description": [ @@ -820,54 +759,45 @@ ], "params": { "fps": "数字:每一秒该显示的影格数" - }, - "returns": "" + } }, "noCursor": { - "description": ["隐藏鼠标。"], - "returns": "" + "description": ["隐藏鼠标。"] }, "displayWidth": { "description": [ "储存整个荧幕宽度的系统变量。这可用来在任何大小的荧幕制作任何大小的全屏程序。" - ], - "returns": "" + ] }, "displayHeight": { "description": [ "储存整个荧幕高度的系统变量。这可用来在任何大小的荧幕制作任何大小的全屏程序。" - ], - "returns": "" + ] }, "windowWidth": { "description": [ "储存窗口内部宽度的系统变量, 此函数映射 window.innerWidth。" - ], - "returns": "" + ] }, "windowHeight": { "description": [ "储存窗口内部高度的系统变量, 此函数映射 window.innerHeight。" - ], - "returns": "" + ] }, "windowResized": { "description": [ "windowResized() 函数将在每次浏览器窗口缩放时被调用。这是个适合缩放画布及或任何其他调整以符合新的窗口大小的地方。" - ], - "returns": "" + ] }, "width": { "description": [ "储存画布宽度的系统变量。这值是由 createCanvas() 函数的第一个参数所定义。比如说,调用函数 createCanvas(320, 240) 将定义此宽度变量为 320。如果一个程式没有使用 createCanvas() 宽度值将默认为 100。" - ], - "returns": "" + ] }, "height": { "description": [ "储存画布高度的系统变量。这值是由 createCanvas() 函数的第二个参数所定义。比如说,调用函数 createCanvas(320, 240) 将定义此高度变量为 240。如果一个程式没有使用 createCanvas() 高度值将默认为 100。" - ], - "returns": "" + ] }, "fullscreen": { "description": [ @@ -922,12 +852,10 @@ "w": "数字:画布的宽度", "h": "数字:画布的高度", "noRedraw": "布尔值:不要马上更新画布" - }, - "returns": "" + } }, "noCanvas": { - "description": ["如果该 p5 绘图不需要画布,此函数将移除默认画布。"], - "returns": "" + "description": ["如果该 p5 绘图不需要画布,此函数将移除默认画布。"] }, "createGraphics": { "description": [ @@ -946,8 +874,7 @@ ], "params": { "mode": "常量:画布的混合模式。BLEND、DARKEST、LIGHTEST、DIFFERENCE、MULTIPLY、EXCLUSION、SCREEN、REPLACE、OVERLAY、HARD_LIGHT、SOFT_LIGHT、DODGE、BURN、ADD 或 NORMAL" - }, - "returns": "" + } }, "setAttributes": { "description": [ @@ -956,7 +883,7 @@ "params": { "key": "字符串:属性名", "value": "布尔值:属性的新值", - "UNKNOWN-PARAM-3": "物件:有键值对的物件" + "obj": "物件:有键值对的物件" } }, "applyMatrix": { @@ -970,12 +897,10 @@ "d": "数字:定义该乘于的 2x3 矩阵", "e": "数字:定义该乘于的 2x3 矩阵", "f": "数字:定义该乘于的 2x3 矩阵" - }, - "returns": "" + } }, "resetMatrix": { - "description": ["将现有的矩阵替换成单位矩阵。"], - "returns": "" + "description": ["将现有的矩阵替换成单位矩阵。"] }, "rotate": { "description": [ @@ -984,29 +909,25 @@ "params": { "angle": "数字:旋转的角度,根据当时的角度模式,以弧度或角度定义", "axis": "p5.Vector|数字[]:(3D 模式下)旋转轴" - }, - "returns": "" + } }, "rotateX": { "description": ["绕着 x 轴旋转。"], "params": { "angle": "数字:旋转角度,根据当时的角度模式,以弧度或角度定义" - }, - "returns": "" + } }, "rotateY": { "description": ["绕着 y 轴旋转。"], "params": { "angle": "数字:旋转角度,根据当时的角度模式,以弧度或角度定义" - }, - "returns": "" + } }, "rotateZ": { "description": ["绕着 x 轴旋转。只适用于 WEBGL 模式。"], "params": { "angle": "数字:旋转角度,根据当时的角度模式,以弧度或角度定义" - }, - "returns": "" + } }, "scale": { "description": [ @@ -1016,9 +937,8 @@ "s": "数字|p5.Vector|数字[]:缩放物件的百分比,或如果给予多个参数 x 轴的缩放百分比", "y": "数字:y 轴的缩放百分比", "z": "数字:z 轴的缩放百分比(只适用于 WEBGL 模式)", - "UNKNOWN-PARAM-4": "p5.Vector|数字[]:各轴缩放百分比" - }, - "returns": "" + "scales": "p5.Vector|数字[]:各轴缩放百分比" + } }, "shearX": { "description": [ @@ -1026,8 +946,7 @@ ], "params": { "angle": "数字:根据当时的角度模式,以弧度或角度定义和切变角度" - }, - "returns": "" + } }, "shearY": { "description": [ @@ -1035,8 +954,7 @@ ], "params": { "angle": "数字:根据当时的角度模式,以弧度或角度定义和切变角度" - }, - "returns": "" + } }, "translate": { "description": [ @@ -1046,87 +964,73 @@ "x": "数字:左/右平移", "y": "数字:上/下平移", "z": "数字:前/后平移(只适用于 WEBGL 模式)", - "UNKNOWN-PARAM-4": "p5.Vector:平移向量" - }, - "returns": "" + "vector": "p5.Vector:平移向量" + } }, "deviceOrientation": { "description": [ "deviceOrientation 系统变量将会储存设备的旋转方向。此变量的值可以是 ‘landscape’ 或 ‘portrait’。如果没有资料可用他会被定义成 ‘undefined’。LANDSCAPE 或 PORTRAIT。" - ], - "returns": "" + ] }, "accelerationX": { "description": [ "accelerationX 系统变量将会储存设备的 x 轴加速度。值的单位为每平方秒米。" - ], - "returns": "" + ] }, "accelerationY": { "description": [ "accelerationY 系统变量将会储存设备的 y 轴加速度。值的单位为每平方秒米。" - ], - "returns": "" + ] }, "accelerationZ": { "description": [ "accelerationZ 系统变量将会储存设备的 z 轴加速度。值的单位为每平方秒米。" - ], - "returns": "" + ] }, "pAccelerationX": { "description": [ "pAccelerationX 系统变量将会储存上一个影格该设备的 x 轴加速度。值的单位为每平方秒米。" - ], - "returns": "" + ] }, "pAccelerationY": { "description": [ "pAccelerationY 系统变量将会储存上一个影格该设备的 y 轴加速度。值的单位为每平方秒米。" - ], - "returns": "" + ] }, "pAccelerationZ": { "description": [ "pAccelerationZ 系统变量将会储存上一个影格该设备的 z 轴加速度。值的单位为每平方秒米。" - ], - "returns": "" + ] }, "rotationX": { "description": [ "rotationX 系统变量将会储存设备在 x 轴的旋转角度。值介于 0 与 +/-180 度之间。

注意:旋转的顺序很重要,比如说,如果同时使用它们必须依 Z-X-Y 的顺序调用或可能会有难以预料的行为。" - ], - "returns": "" + ] }, "rotationY": { "description": [ "rotationY 系统变量将会储存设备在 y 轴的旋转角度。值介于 0 与 +/-90 度之间。

注意:旋转的顺序很重要,比如说,如果同时使用它们必须依 Z-X-Y 的顺序调用或可能会有难以预料的行为。" - ], - "returns": "" + ] }, "rotationZ": { "description": [ "rotationZ 系统变量将会储存设备在 z 轴的旋转角度。值介于 0 与 359 度之间。

与 rotationX 及 rotationY 不同的是,这变量只能在有内建指南针的设备使用。

注意:旋转的顺序很重要,比如说,如果同时使用它们必须依 Z-X-Y 的顺序调用或可能会有难以预料的行为。" - ], - "returns": "" + ] }, "pRotationX": { "description": [ "pRotationX 系统变量将会储存上一个影格该设备在 x 轴的旋转角度。值介于 0 与 +/-180 度之间。

pRotationX 可以和 rotationX 一起使用以找出设备 x 轴的旋转方向。" - ], - "returns": "" + ] }, "pRotationY": { "description": [ "pRotationY 系统变量将会储存上一个影格该设备在 y 轴的旋转角度。值介于 0 与 +/-90 度之间。

pRotationY 可以和 rotationY 一起使用以找出设备 y 轴的旋转方向。" - ], - "returns": "" + ] }, "pRotationZ": { "description": [ "pRotationZ 系统变量将会储存上一个影格该设备在 z 轴的旋转角度。值介于 0 与 359 度之间。

pRotationZ 可以和 rotationZ 一起使用以找出设备 z 轴的旋转方向。" - ], - "returns": "" + ] }, "setMoveThreshold": { "description": [ @@ -1134,8 +1038,7 @@ ], "params": { "value": "数字:阈值" - }, - "returns": "" + } }, "setShakeThreshold": { "description": [ @@ -1143,62 +1046,52 @@ ], "params": { "value": "数字:阈值" - }, - "returns": "" + } }, "deviceMoved": { "description": [ "deviceMoved() 函数将在设备在 X、Y 或 Z 轴被移动多过阈值时被调用。默认阈值为 0.5。" - ], - "returns": "" + ] }, "deviceTurned": { "description": [ "deviceTurned() 函数将在设备被连续旋转多过 90 度时被调用。

触发 deviceTurned() 的旋转轴将被储存在 turnAxis 变量中。deviceTurned() 函数能被锁定在 X、Y 或 Z 以确保只有所定义的轴会导致函数被调用,您只需比较 turnAxis 变量和 'X'、'Y' 或 'Z' 字符串。" - ], - "returns": "" + ] }, "deviceShaken": { "description": [ "deviceShaken() 函数将在设备的 accelerationX 及 accelerationY 加速度值改变超过阈值。默认阈值为 30。" - ], - "returns": "" + ] }, "keyIsPressed": { "description": [ "keyIsPressed 布尔系统变量将会在任何键被按下时为真(true)而没键被按下时为假(false)。" - ], - "returns": "" + ] }, "key": { "description": [ "key 系统变量将会储存上一个被键入的键盘键值。以获得正确的大小写,最好在 keyTyped() 内使用。至于非 ASCII 值的键,请使用 keyCode 变量。" - ], - "returns": "" + ] }, "keyCode": { "description": [ "keyCode 变量可用来探测特别键如 BACKSPACE、DELETE、ENTER、RETURN、TAB、ESCAPE、SHIFT、CONTROL、OPTION、ALT、UP_ARROW、DOWN_ARROW、LEFT_ARROW、RIGHT_ARROW 是否被按下。您也可以使用特别网站如 keycode.info 以找出自定义键的 keyCode。" - ], - "returns": "" + ] }, "keyPressed": { "description": [ "keyPressed() 函数将会在每一次任何键被按下时被调用。被按下的键的 keyCode 将被储存在 keyCode 变量内。

对于非 ASCII 值的键,请使用 keyCode 变量。您能查看 keyCode 是否等于 BACKSPACE、DELETE、ENTER、RETURN、TAB、ESCAPE、SHIFT、CONTROL、OPTION、ALT、UP_ARROW、DOWN_ARROW、LEFT_ARROW、RIGHT_ARROW。

至于 ASCII 键值它们的值会被储存在 key 变量内。不过,它并不会分辨大小写。因此,建议使用 keyTyped() 以读取 key 变量,因为其大小写在这里会被分辨出来。

取决于操作系统如何处理按键重复,按住一个键可能使 keyTyped() (及 keyReleased())被调用多过一次。重复的速度应操作系统及该电脑的设置而定。

不同浏览器可能会有不同附属于个别键盘事件的默认行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "keyReleased": { "description": [ "keyReleased() 函数将会在每一次任何键被释放时被调用。请查看 key 及 keyCode 以知更多详情。

不同浏览器可能会有不同附属于个别键盘事件的默认行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "keyTyped": { "description": [ "keyTyped() 函数将会在每一次任何键被按下时被调用,可是会忽略操作键如 Ctrl、Shift 及 Alt。被按下的键的 keyCode 将被储存在 keyCode 变量内。

取决于操作系统如何处理按键重复,按住一个键可能使 keyTyped() (及 keyReleased())被调用多过一次。重复的速度应操作系统及该电脑的设置而定。

不同浏览器可能会有不同附属于个别键盘事件的默认行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "keyIsDown": { "description": [ @@ -1206,98 +1099,82 @@ ], "params": { "code": "数字:该查看的键" - }, - "returns": "" + } }, "mouseX": { "description": [ "mouseX 系统变量将会储存当时的鼠标相对于画布 (0, 0) 位置的的横向位置。如果使用的是触动而不是滑鼠的话,mouseX 将会储存上一个触动点的 x 值。" - ], - "returns": "" + ] }, "mouseY": { "description": [ "mouseY 系统变量将会储存当时的鼠标相对于画布 (0, 0) 位置的的直向位置。如果使用的是触动而不是滑鼠的话,mouseY 将会储存上一个触动点的 y 值。" - ], - "returns": "" + ] }, "pmouseX": { "description": [ "pmouseX 系统变量将会储存上一个影格鼠标或触动点相对于画布 (0, 0) 位置的的横向位置。" - ], - "returns": "" + ] }, "pmouseY": { "description": [ "pmouseY 系统变量将会储存上一个影格鼠标或触动点相对于画布 (0, 0) 位置的的直向位置。" - ], - "returns": "" + ] }, "winMouseX": { "description": [ "winMouseX 系统变量将会储存当时鼠标相对于窗口 (0, 0) 位置的横向位置。" - ], - "returns": "" + ] }, "winMouseY": { "description": [ "winMouseY 系统变量将会储存当时鼠标相对于窗口 (0, 0) 位置的直向位置。" - ], - "returns": "" + ] }, "pwinMouseX": { "description": [ "pwinMouseX 系统变量将会储存上一个影格鼠标相对于窗口 (0, 0) 位置的横向位置。" - ], - "returns": "" + ] }, "pwinMouseY": { "description": [ "pwinMouseY 系统变量将会储存上一个影格鼠标相对于窗口 (0, 0) 位置的直向位置。" - ], - "returns": "" + ] }, "mouseButton": { "description": [ "p5 将自动记录滑鼠键是否被按下及哪个键被按下。mouseButton 系统变量的值可能是 LEFT、RIGHT 或 CENTER,取决于上一个被按下的滑鼠键。请注意:不同的浏览器可能记录不同的 mouseButton 值。" - ], - "returns": "" + ] }, "mouseIsPressed": { "description": [ "mouseIsPressed 系统变量将会在滑鼠键被按下时为真(true),而没按下时为假(false)。" - ], - "returns": "" + ] }, "mouseMoved": { "description": [ "mouseMoved() 函数将在每次鼠标移动而滑鼠键没有被按下的时候被调用。

不同浏览器可能有不同附属于个别滑鼠事件的行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "mouseDragged": { "description": [ "mouseDragged() 函数将在每次鼠标移动及滑鼠键正被按下的时候被调用。如果 mouseDragged() 函数并未有被定义,touchMoved() 函数有被定义的话将会被调用。

不同浏览器可能有不同附属于个别滑鼠事件的行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "mousePressed": { "description": [ "mousePressed() 函数将在每次滑鼠键被按下时被调用。mouseButton 函数(请参考其文献)可以被用来探测哪一个滑鼠键刚被按下。如果 mousePressed() 函数并未有被定义,touchStarted() 函数有被定义的话将会被调用。

不同浏览器可能有不同附属于个别滑鼠事件的行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "mouseReleased": { "description": [ "mouseReleased() 函数将在每次滑鼠键被释放时被调用。如果 mouseReleased() 函数并未有被定义,touchEnded() 函数有被定义的话将会被调用。

不同浏览器可能有不同附属于个别滑鼠事件的行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "mouseClicked": { "description": [ "mouseClicked() 函数将在滑鼠键被按下然后被释放后被调用。

不同浏览器处理滑鼠点击的方式不大一样,所以这函数只有在滑鼠左键被点击时才保证会被触发。如果想要处理其他滑鼠键的点击或释放事件,请参考 mousePressed() 或 mouseReleased()。

不同浏览器可能有不同附属于个别滑鼠事件的行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "doubleClicked": { "description": [ @@ -1307,32 +1184,27 @@ "mouseWheel": { "description": [ "mouseWheel() 函数将在每次直向滑鼠滚轮事件被触发式被调用,可以由实际的滑鼠滚轮或摸板触发。

event.delta 属性将返回滑鼠滚轮所滚动的量。这值可以是正数或负数,取决于滚动的方向(在 OS X 如果启用“自然”滚屏方向,正反方向将相反)。" - ], - "returns": "" + ] }, "touches": { "description": [ "touches[] 系统变量将储存一个含有现在所有触动点相对于画布 (0, 0) 位置的位置数组,及分辨个别触动点移动时的 ID。数组内的每个元素都会有 x、y 及 id 属性。

touches[] 数组并不受 Safari 及 IE 移动设备(包括手提电脑)所支持。" - ], - "returns": "" + ] }, "touchStarted": { "description": [ "touchStarted() 函数将在每次触动事件被触发时被调用。如果 touchStarted() 函数并未有被定义,mousePressed() 函数有被定义的话将会被调用。

不同浏览器可能有不同附属于个别触动事件的行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "touchMoved": { "description": [ "touchMoved() 函数将在每次触点移动事件被触发时被调用。如果 touchMoved() 函数并未有被定义,mouseDragged() 函数有被定义的话将会被调用。

不同浏览器可能有不同附属于个别触动事件的行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "touchEnded": { "description": [ "touchEnded() 函数将在每次触动结束时被调用。如果 touchEnded() 函数并未有被定义,mouseReleased() 函数有被定义的话将会被调用。

不同浏览器可能有不同附属于个别触动事件的行为。以防止这些默认行为发生,只需在函数尾端加 “return false”。" - ], - "returns": "" + ] }, "createImage": { "description": [ @@ -1352,8 +1224,7 @@ "selectedCanvas": "p5.Element|HTMLCanvasElement:una variable representando un canvas HTML5 específico (opcional)", "filename": "字符串", "extension": "字符串:'jpg' 或 'png'" - }, - "returns": "" + } }, "saveFrames": { "description": [ @@ -1365,8 +1236,7 @@ "duration": "数字:该捕捉的影格的秒数", "framerate": "数字:捕捉影格的帧率", "callback": "函数(数组):一个用来处理图像资料的回调函数。此函数将会被给予一个数组为参数。此数组将会储存所定义的捕捉影格物件。每一个物件都会有三个属性:imageData - 为 image/octet-stream 类型、filename 及 extension。" - }, - "returns": "" + } }, "loadImage": { "description": [ @@ -1385,20 +1255,19 @@ ], "params": { "img": "p5.Image|p5.Element:该显示的图像", - "dx": "数字:图像左上角的 x 坐标", - "dy": "数字:图像左上角的 y 坐标", - "dWidth": "数字:绘制图像的宽度", - "dHeight": "数字:绘制图像的高度", - "sx": "数字:绘制图像的终点方形的 x 坐标位置", - "sy": "数字:绘制图像的终点方形的 y 坐标位置", - "sWidth": "数字:终点方形的宽度", - "sHeight": "数字:终点方形的高度", - "UNKNOWN-PARAM-10": "数字:该画进终点方形的原图像子部分的 x 坐标", - "UNKNOWN-PARAM-11": "数字:该画进终点方形的原图像子部分的 y 坐标", - "UNKNOWN-PARAM-12": "数字:该画进终点方形的原图像子部分的宽度", - "UNKNOWN-PARAM-13": "数字:该画进终点方形的原图像子部分的高度" - }, - "returns": "" + "x": "数字:图像左上角的 x 坐标", + "y": "数字:图像左上角的 y 坐标", + "width": "数字:绘制图像的宽度", + "height": "数字:绘制图像的高度", + "dx": "数字:绘制图像的终点方形的 x 坐标位置", + "dy": "数字:绘制图像的终点方形的 y 坐标位置", + "dWidth": "数字:终点方形的宽度", + "dHeight": "数字:终点方形的高度", + "sx": "数字:该画进终点方形的原图像子部分的 x 坐标", + "sy": "数字:该画进终点方形的原图像子部分的 y 坐标", + "sWidth": "数字:该画进终点方形的原图像子部分的宽度", + "sHeight": "数字:该画进终点方形的原图像子部分的高度" + } }, "tint": { "description": [ @@ -1409,16 +1278,14 @@ "v2": "数字:绿彩值或饱和度值,需在被定义的范围内", "v3": "数字:蓝彩值或亮度值,需在被定义的范围内", "alpha": "数字:", - "UNKNOWN-PARAM-5": "字符串:颜色字符串", - "UNKNOWN-PARAM-6": "数字:灰阶值", - "UNKNOWN-PARAM-7": "数字[]:一个有红、绿、蓝及透明度值的数组", - "UNKNOWN-PARAM-8": "p5.Color:着色色值" - }, - "returns": "" + "value": "字符串:颜色字符串", + "gray": "数字:灰阶值", + "values": "数字[]:一个有红、绿、蓝及透明度值的数组", + "color": "p5.Color:着色色值" + } }, "noTint": { - "description": ["移除当时显示图像的填色值并将其恢复成显示图形的原色调。"], - "returns": "" + "description": ["移除当时显示图像的填色值并将其恢复成显示图形的原色调。"] }, "imageMode": { "description": [ @@ -1426,14 +1293,12 @@ ], "params": { "mode": "常量:CORNER、CORNERS 或 CENTER" - }, - "returns": "" + } }, "pixels": { "description": [ "此数组为一个储存显示窗口内所有像素值的 Uint8ClampedArray。这些值都为数字。这数组的大小为(同时考虑像素密度)显示窗口的大小 x4,分别代表每个像素由左到右,上到下的 R、G、B、A 值。视网膜显示及其他高密度显示器将会有更多像素(pixelDensity^2 倍)。比如说,如果图像为 100x100 像素,总共会有 40,000 个元素在 pixels[] 数组内。而在一个视网膜显示,将会有 160,000 个元素。

数组内最初四个值(指数 0-3)将会是在坐标 (0, 0) 的像素的 R、G、B、A 值。下四个值(指数 4-7)将会是在坐标 (1, 0) 的像素的 R、G、B、A 值。一般上,如果要设置像素 (x, y) 的值:
CODE BLOCK PENDING
虽然以上的方式有点复杂,它能提供足够的弹性以应对任何像素密度的显示。注意 set() 将会自动处理设定所有在任何像素密度下 (x, y) 坐标在 pixels[] 内的值,不过程序性能可能在像素数组被更改很多次时时不佳。

在使用这个数组之前,像素资料必须先使用 loadPixels() 函数加载。在数组资料被修改后,updatePixels() 函数必须被调用以更新图像资料。

注意这不是个普通的 Javascript 数组。这表示 Javascript 数组函数如 slice()arrayCopy() 将不会有效果。" - ], - "returns": "" + ] }, "blend": { "description": [ @@ -1450,8 +1315,7 @@ "dw": "整数:终点图像的宽度", "dh": "整数:终点图像的高度", "blendMode": "常量:混合模式。BLEND、DARKEST、LIGHTEST、DIFFERENCE、MULTIPLY、EXCLUSION、SCREEN、REPLACE、OVERLAY、HARD_LIGHT、SOFT_LIGHT、DODGE、BURN、ADD 或 NORMAL。" - }, - "returns": "" + } }, "copy": { "description": [ @@ -1467,8 +1331,7 @@ "dy": "整数:终点图像左上角的 y 坐标", "dw": "整数:终点图像的宽度", "dh": "整数:终点图像的高度" - }, - "returns": "" + } }, "filter": { "description": [ @@ -1477,37 +1340,34 @@ "params": { "filterType": "常量:THRESHOLD、GRAY、OPAQUE、INVERT、POSTERIZE、BLUR、ERODE、DILATE 或 BLUR。", "filterParam": "数字:每个过滤器独有的可选性参数,请看以上" - }, - "returns": "" + } }, "get": { "description": [ "返回任何像素值的一个为 [R,G,B,A] 的数组或捕捉图像的一部分。如果没有提供任何参数,将会返回整个图像。可使用 x 及 y 参数以取得一个像素的值。多加定义 w 及 h 参数可取的显示窗口的一部分。当在取得图像时,x 及 y 参数将定义图像的左上角坐标值,无论当时的图像模式为何。

如果欲取得的像素在图像外,将返回 [0,0,0,255]。以取得根据当时的颜色值范围及颜色模式的数字,请使用 getColor 而不是 get。

使用 get(x, y) 以取得一个像素的颜色相对来说简单,但是其速度并没有直接从 pixels[] 数组获取数据来的快。与使用 get(x, y) 有相同的效果但使用 pixels[] 及像素密度 d 的范例如下 var x, y, d; // 设置这为坐标 var off = (y width + x) d * 4; var components = [ pixels[off], pixels[off + 1], pixels[off + 2], pixels[off + 3] ]; print(components);

请参考 pixels[] 文献以知更多详情。" ], "params": { - "the": "数字:像素的 x 坐标", - "UNKNOWN-PARAM-2": "数字:像素的 y 坐标", - "UNKNOWN-PARAM-3": "数字:宽度", - "UNKNOWN-PARAM-4": "数字:高度" + "x": "数字:像素的 x 坐标", + "y": "数字:像素的 y 坐标", + "w": "数字:宽度", + "h": "数字:高度" }, "returns": "数字[]|p5.Image:在 x,y 的像素值数组或 p5.Image" }, "loadPixels": { "description": [ "将显示窗口的像素资料加载到 pixels[] 数组里。这函数必须在读写 pixels[] 之前被调用。注意只有使用 set() 或直接修改 pixels[] 的改变会发生。" - ], - "returns": "" + ] }, "set": { "description": [ "改变任何像素的颜色,或直接在显示窗口内绘画一个图像。

x 及 y 参数用于定义该改变的像素而 c 参数用于定义颜色值。这可以是一个 p5.Color 物件或一个 [R, G, B, A] 像素数组。它也能是一个灰阶值。在设定一个图像时,x 及 y 参数将定义图像左上角的坐标值,无论当时的图像模式为何。

在使用 set() 后,您必须调用 updatePixels() 以使您的改变生效。这应该在所有像素都被设定后才被调用,而且也必须在调用 get() 或绘制图像之前调用。

使用 set(x, y) 设置一个像素的颜色相对来说简单,但使其速度并没有直接将数据写在 pixels[] 数组里来的快。直接使用 pixels[] 设置像素值可能在使用视网膜显示器时比较复杂,不过它会在每一个循环有很多像素需要被设定时表现得更好。

请参考 pixels[] 文献以知更多详情。" ], "params": { - "key": "数字:像素的 x 坐标", - "value": "数字:像素的 y 坐标", - "UNKNOWN-PARAM-3": "数字|数字[]|物件:插入一个灰阶值 | 一个像素数组 | 一个 p5.Color 物件 | 一个用于复制的 p5.Image" - }, - "returns": "" + "x": "数字:像素的 x 坐标", + "y": "数字:像素的 y 坐标", + "c": "数字|数字[]|物件:插入一个灰阶值 | 一个像素数组 | 一个 p5.Color 物件 | 一个用于复制的 p5.Image" + } }, "updatePixels": { "description": [ @@ -1518,8 +1378,7 @@ "y": "数字:欲更新的区域的左上角 y 坐标", "w": "数字:欲更新的区域的宽度", "h": "数字:欲更新的区域的高度" - }, - "returns": "" + } }, "loadFont": { "description": [ @@ -1598,8 +1457,7 @@ "data": "物件|布尔值:与请求一起传送的参数资料", "callback": "函数:在 httpGet() 完成后该执行的函数,返回的资料物件将会是函数第一个参数", "errorCallback": "函数:在发生错误时该执行的函数,回复将会是函数第一个参数" - }, - "returns": "" + } }, "httpPost": { "description": [ @@ -1611,8 +1469,7 @@ "data": "物件|布尔值:与请求一起传送的参数资料", "callback": "函数:在 httpPost() 完成后该执行的函数,返回的资料物件将会是函数第一个参数", "errorCallback": "函数:在发生错误时该执行的函数,回复将会是函数第一个参数" - }, - "returns": "" + } }, "httpDo": { "description": [ @@ -1625,9 +1482,8 @@ "data": "物件|布尔值:与请求一起传送的参数资料", "callback": "函数:在 httpDo() 完成后该执行的函数,返回的资料物件将会是函数第一个参数", "errorCallback": "函数:在发生错误时该执行的函数,回复将会是函数第一个参数", - "UNKNOWN-PARAM-7": "物件:Request 物件,请参考 “fetch” API 文献以了解可使用设置" - }, - "returns": "" + "options": "物件:Request 物件,请参考 “fetch” API 文献以了解可使用设置" + } }, "createWriter": { "description": [""], @@ -1643,9 +1499,8 @@ "params": { "filename": "物件|字符串:如果所提供的是文件名,此函数将会使用该文件名加上 png 或 jpg 文件扩展名来储存画布为一个图像。如果所提供的是物件,此函数则会一物件所定义的方式储存文件(请参考以上范例)。", "extension": "字符串:如果所提供的第一个参数为物件,那第二个参数则定义文件名,同时必须包括适当的文件扩展名(请参考以上范例)。", - "UNKNOWN-PARAM-3": "布尔值|字符串:依文件类型而定的设定。比如说,在储存 JSON 时,true 表示输出文件将会针对文件大小进行优化,而同时牺牲可读性。" - }, - "returns": "" + "options": "布尔值|字符串:依文件类型而定的设定。比如说,在储存 JSON 时,true 表示输出文件将会针对文件大小进行优化,而同时牺牲可读性。" + } }, "saveJSON": { "description": [ @@ -1655,8 +1510,7 @@ "json": "数组|物件:", "name": "字符串:", "optimize": "布尔值:如果为 true,将移除输出文件内的换行符及空格以优化文件大小(但牺牲可读性)" - }, - "returns": "" + } }, "saveStrings": { "description": [ @@ -1666,8 +1520,7 @@ "list": "字符串[]:该输出的字符串数组", "filename": "字符串:输出文件的名字", "extension": "字符串:文件扩展名" - }, - "returns": "" + } }, "saveTable": { "description": [ @@ -1677,8 +1530,7 @@ "table": "p5.Table:该储存在文件内的表格物件", "filename": "字符串:储存表格文件的名字", "options": "字符串:可以是 \"tsv\"、\"csv\" 或 \"html\"" - }, - "returns": "" + } }, "day": { "description": [ @@ -1841,7 +1693,7 @@ "params": { "n0": "数字:用于比较的数字", "n1": "数字:用于比较的数字", - "UNKNOWN-PARAM-3": "数字[]:用于比较的数字" + "ns": "数字[]:用于比较的数字" }, "returns": "数字:最高值的数字" }, @@ -1852,7 +1704,7 @@ "params": { "n0": "数字:用于比较的数字", "n1": "数字:用于比较的数字", - "UNKNOWN-PARAM-3": "数字[]:用于比较的数字" + "ns": "数字[]:用于比较的数字" }, "returns": "数字:最低值的数字" }, @@ -1922,8 +1774,7 @@ "params": { "lod": "数字:噪音该使用的八度数", "falloff": "数字:每个八度的衰退因数" - }, - "returns": "" + } }, "noiseSeed": { "description": [ @@ -1931,8 +1782,7 @@ ], "params": { "seed": "数字:随机种子值" - }, - "returns": "" + } }, "acos": { "description": [ @@ -2020,8 +1870,7 @@ "description": ["定义当时 p5 的角度模式。默认模式为 RADIANS(弧度)。"], "params": { "mode": "常量:RADIANS 或 DEGREES" - }, - "returns": "" + } }, "randomSeed": { "description": [ @@ -2029,8 +1878,7 @@ ], "params": { "seed": "数字:随机种子值" - }, - "returns": "" + } }, "random": { "description": [ @@ -2039,7 +1887,7 @@ "params": { "min": "数字:最低值(包括此值)", "max": "数字:最高值(不包括此值)", - "UNKNOWN-PARAM-3": "数组:供选择的数组" + "choices": "数组:供选择的数组" }, "returns": "数字:随机数" }, @@ -2060,8 +1908,7 @@ "params": { "horizAlign": "常量:水平对齐,LEFT、CENTER 或 RIGHT", "vertAlign": "常量:垂直对齐,TOP、BOTTOM、CENTER 或 BASELINE" - }, - "returns": "" + } }, "textLeading": { "description": [ @@ -2069,8 +1916,7 @@ ], "params": { "leading": "数字:行与行之间的像素距离" - }, - "returns": "" + } }, "textSize": { "description": [ @@ -2078,8 +1924,7 @@ ], "params": { "theSize": "数字:字体的像素大小" - }, - "returns": "" + } }, "textStyle": { "description": [ @@ -2087,8 +1932,7 @@ ], "params": { "theStyle": "常量:字体的风格,可以是 NORMAL、ITALIC 或 BOLD" - }, - "returns": "" + } }, "textWidth": { "description": ["计算及返回任何字符或字符串的宽度。"], @@ -2117,16 +1961,14 @@ "y": "数字:文字的 y 坐标", "x2": "数字:默认上,文字格的宽度,请参考 rectMode()", "y2": "数字:默认上,文字格的高度,请参考 rectMode()" - }, - "returns": "" + } }, "textFont": { "description": ["定义使用 text() 函数绘制文字时该使用的字形。"], "params": { "font": "物件|字符串:一个使用 loadFont() 加载的字形,或一个代表 Web 安全字体(一个所有系统都通用的字形)的字符串", "size": "数字:字形大小" - }, - "returns": "" + } }, "append": { "description": [ @@ -2135,8 +1977,7 @@ "params": { "array": "数组:该附加到的数组", "value": "任何:该附加进数组的元素" - }, - "returns": "" + } }, "arrayCopy": { "description": [ @@ -2148,8 +1989,7 @@ "dst": "数组:终点数组", "dstPosition": "数字:在终点数组内的开端指数", "length": "数字:该复制的元素量" - }, - "returns": "" + } }, "concat": { "description": [ @@ -2167,8 +2007,7 @@ ], "params": { "list": "数组:该倒转的数组" - }, - "returns": "" + } }, "shorten": { "description": [ @@ -2196,8 +2035,7 @@ "params": { "list": "数组:该排列的数组", "count": "整数:该排列的元素数,由 0 开始" - }, - "returns": "" + } }, "splice": { "description": [ @@ -2207,8 +2045,7 @@ "list": "数组:拼接进的数组", "value": "任何:欲拼接进数组的值", "position": "整数:数组内该添加该元素的位置" - }, - "returns": "" + } }, "subset": { "description": [ @@ -2237,7 +2074,7 @@ "params": { "n": "字符串|布尔值|数字:该解析的值", "radix": "整数:该转换成的基数", - "UNKNOWN-PARAM-3": "数组:该解析的值" + "ns": "数组:该解析的值" }, "returns": "数字:该值的整数值" }, @@ -2265,7 +2102,7 @@ ], "params": { "n": "字符串|布尔值|数字:该解析的值", - "UNKNOWN-PARAM-2": "数组:该解析的值" + "ns": "数组:该解析的值" }, "returns": "数字:该值的字节值" }, @@ -2275,7 +2112,7 @@ ], "params": { "n": "字符串|数字:该解析的值", - "UNKNOWN-PARAM-2": "数组:该解析的值" + "ns": "数组:该解析的值" }, "returns": "字符串:该值的字符串值" }, @@ -2285,7 +2122,7 @@ ], "params": { "n": "字符串:该解析的值", - "UNKNOWN-PARAM-2": "数组:该解析的值" + "ns": "数组:该解析的值" }, "returns": "数字:该值的整数值" }, @@ -2296,7 +2133,7 @@ "params": { "n": "数字:该解析的值", "digits": "数字", - "UNKNOWN-PARAM-3": "数字[]:该解析的值" + "ns": "数字[]:该解析的值" }, "returns": "字符串:该值的十六进制值" }, @@ -2306,7 +2143,7 @@ ], "params": { "n": "数字:该解析的值", - "UNKNOWN-PARAM-2": "数组:该解析的值" + "ns": "数组:该解析的值" }, "returns": "数字:该十六进制值的整数值" }, @@ -2348,7 +2185,7 @@ "num": "数字|字符串:该格式化的数字", "left": "整数|字符串:小数点左边的位数", "right": "整数|字符串:小数点右边的位数", - "UNKNOWN-PARAM-4": "数组:该格式化的数字" + "nums": "数组:该格式化的数字" }, "returns": "字符串:格式化后的字符串" }, @@ -2359,8 +2196,7 @@ "params": { "num": "数字|字符串:该格式化的数字", "right": "整数|字符串:小数点左边的位数", - "UNKNOWN-PARAM-3": "整数|字符串:小数点右边的位数", - "UNKNOWN-PARAM-4": "数组:该格式化的数字" + "nums": "数组:该格式化的数字" }, "returns": "字符串:格式化后的字符串" }, @@ -2383,7 +2219,7 @@ "num": "数字:该格式化的数字", "left": "整数:小数点左边的位数", "right": "整数:小数点右边的位数", - "UNKNOWN-PARAM-4": "数组:该格式化的数字" + "nums": "数组:该格式化的数字" }, "returns": "字符串:格式化后的字符串" }, @@ -2412,8 +2248,8 @@ "从一个字符串的前端及后端删除空白字符。除了一般的空白字符如空格、回车及制表符之外,这函数也将删除 Unicode “nbsp” 字符。" ], "params": { - "column": "字符串:该修剪的字符串", - "UNKNOWN-PARAM-2": "数组:该修剪的字符串数组" + "str": "字符串:该修剪的字符串", + "strs": "数组:该修剪的字符串数组" }, "returns": "字符串:修剪后的字符串" }, @@ -2431,8 +2267,7 @@ "upX": "数字:相机向上方向量的 x 分量", "upY": "数字:相机向上方向量的 y 分量", "upZ": "数字:相机向上方向量的 z 分量" - }, - "returns": "" + } }, "perspective": { "description": [ @@ -2443,8 +2278,7 @@ "aspect": "数字:相机视锥的长宽比", "near": "数字:视锥近平面的长度", "far": "数字:视锥远平面的长度" - }, - "returns": "" + } }, "ortho": { "description": ["定义正射相机。"], @@ -2455,8 +2289,7 @@ "top": "数字:相机视锥的顶平面", "near": "数字:相机视锥的近平面", "far": "数字:相机视锥的远平面" - }, - "returns": "" + } }, "ambientLight": { "description": ["使用所定义的颜色创造一个环境光。"], @@ -2465,12 +2298,11 @@ "v2": "数字:绿彩值或饱和度值,需在被定义的范围内", "v3": "数字:蓝彩值或亮度值,需在被定义的范围内", "alpha": "数字:", - "UNKNOWN-PARAM-5": "字符串:颜色字符串", - "UNKNOWN-PARAM-6": "数字:灰阶值", - "UNKNOWN-PARAM-7": "数字[]:一个有红、绿、蓝及透明度值的数组", - "UNKNOWN-PARAM-8": "p5.Color:环境光色" - }, - "returns": "" + "value": "字符串:颜色字符串", + "gray": "数字:灰阶值", + "values": "数字[]:一个有红、绿、蓝及透明度值的数组", + "color": "p5.Color:环境光色" + } }, "directionalLight": { "description": ["使用所定义的颜色及方向创造一个定向光。"], @@ -2478,13 +2310,12 @@ "v1": "数字:红彩值或色调值,需在被定义的范围内", "v2": "数字:绿彩值或饱和度值", "v3": "数字:蓝彩值或亮度值", - "x": "p5.Vector:光的方向", - "y": "数字[]|字符串|p5.Color:颜色数组、CSS 颜色字符串或 p5.Color 颜色值", - "z": "数字:x 轴方向", - "UNKNOWN-PARAM-7": "数字:y 轴方向", - "UNKNOWN-PARAM-8": "数字:z 轴方向" - }, - "returns": "" + "position": "p5.Vector:光的方向", + "color": "数字[]|字符串|p5.Color:颜色数组、CSS 颜色字符串或 p5.Color 颜色值", + "x": "数字:x 轴方向", + "y": "数字:y 轴方向", + "z": "数字:z 轴方向" + } }, "pointLight": { "description": ["使用所定义的颜色及灯光位置创造一个点光源。"], @@ -2495,10 +2326,9 @@ "x": "数字:x 轴方向", "y": "数字:y 轴方向", "z": "数字:z 轴方向", - "UNKNOWN-PARAM-7": "p5.Vector:光的方向", - "UNKNOWN-PARAM-8": "数字[]|字符串|p5.Color:颜色数组、CSS 颜色字符串或 p5.Color 颜色值" - }, - "returns": "" + "position": "p5.Vector:光的方向", + "color": "数字[]|字符串|p5.Color:颜色数组、CSS 颜色字符串或 p5.Color 颜色值" + } }, "loadShader": { "description": [ @@ -2529,8 +2359,7 @@ "normalMaterial": { "description": [ "形状的法线材料。您可在此范例查看所有可用的材料。" - ], - "returns": "" + ] }, "texture": { "description": [ @@ -2538,8 +2367,7 @@ ], "params": { "tex": "p5.Image|p5.MediaElement|p5.Graphics:该渲染成纹理的二维图像" - }, - "returns": "" + } }, "ambientMaterial": { "description": [ @@ -2549,10 +2377,8 @@ "v1": "数字:红彩值或色调值,需在被定义的范围内", "v2": "数字:绿彩值或饱和度值", "v3": "数字:蓝彩值或亮度值", - "UNKNOWN-PARAM-4": "数字:透明度", - "UNKNOWN-PARAM-5": "数字[]|字符串|p5.Color:颜色数组、CSS 颜色字符串或 p5.Color 颜色值" - }, - "returns": "" + "color": "数字[]|字符串|p5.Color:颜色数组、CSS 颜色字符串或 p5.Color 颜色值" + } }, "specularMaterial": { "description": [ @@ -2562,81 +2388,9 @@ "v1": "数字:红彩值或色调值,需在被定义的范围内", "v2": "数字:绿彩值或饱和度值", "v3": "数字:蓝彩值或亮度值", - "UNKNOWN-PARAM-4": "数字:透明度", - "UNKNOWN-PARAM-5": "数字[]|字符串|p5.Color:颜色数组、CSS 颜色字符串或 p5.Color 颜色值" - }, - "returns": "" - } - }, - "p5.RendererGL": { - "returns": "p5: 该 p5 物件" - }, - "p5.Shader": { - "description": ["Clase Shader para el modo WEBGL"], - "params": { - "renderer": "p5.RendererGL: una instancia de p5.RendererGL que servirá de contexto GL para este nuevo p5.Shader", - "vertSrc": "String: código fuente para el vertex shader (en forma de string)", - "fragSrc": "String: código fuente para el fragment shader (en forma de string)" - }, - "setUniform": { - "description": [ - "Wrapper de las funciones gl.uniform. Como almacenamos información de uniform en el shader, la podemos usar para revisar los datos provistos y llamar a la función apropiada." - ] - } - }, - "p5.Table": { - "description": [ - "Los objetos Table almacenan datos con múltiples filas y columnas, tal como una hoja de cálculo tradicional. Los objetos Table pueden ser generados desde cero, dinámicamente, o usando datos desde un archivo existente." - ], - "params": { - "rows": "Arreglo: un arreglo de objetos p5.TableRow" - }, - "returns": "p5.Table: 该 p5 物件.Table generado" - }, - "p5.TableRow": { - "description": [ - "Un objeto TableRow representa una única fila de datos, grabados en columnas, de una tabla. Un objeto TableRow contiene tanto un arreglo ordenado, como un objeto JSON desordenado." - ], - "params": { - "str": "String: opcional, puebla la fila con una serie de valores, separados por el separador", - "separator": "String: por defecto, valores separados por coma (csv)" - }, - "returns": "该 p5 物件" - }, - "p5.XML": { - "description": [ - "XML es una representación de un objeto XML, capaz de procesar código XML. Usa loadXML() para cargar archivos externos XML y crear objetos XML" - ], - "params": { - "UNKNOWN-PARAM-1": "String:" - }, - "returns": "p5.XML: 该 p5 物件.XML generado" - }, - "p5.Vector": { - "description": [ - "Una clase para describir un vector de dos o tres dimensiones, específicamente un vector euclideano (también conocido como geométrico). Un vector es una entidad que tiene tanto magnitud como dirección. El tipo de datos, sin embargo, graba los componentes del vector (x, y para 2D y x,y,z para 3D). La magnitud y la dirección pueden ser calculados con los métodos mag() y heading(). En muchos de los ejemplos de p5.js, verás que p5.Vector es usado para describir una posición, velocidad o aceleración. Por ejemplo, si consideras un rectángulo moviéndose a lo largo de la pantalla, en cada instante tiene una posición (un vector que apunta desde el origen hasta su ubicación), una velocidad(la tasa a la que la posición del objeto cambia por unidad de tiempo, expresada como vector), y aceleración (la tasa a la que la velocidad del objeto cambia por unidad de tiempo, expresada como vector). Como los vectores representan grupos de valores, no podemos simplemente usar las operaciones tradicionales de adición, multiplicación, etc. En vez de eso, necesitaremos hacer matemática de vectores, lo que es simplificado con los métodos dentro de la clase p5.Vector." - ], - "params": { - "x": "Número: componente x del vector", - "y": "Número: componente y del vector", - "z": "Número: componente z del vector" - }, - "returns": "该 p5 物件" - }, - "p5.Font": { - "description": ["Clase base para manipulación de tipografía"], - "params": { - "pInst": "物件:puntero a la instancia p5" - }, - "returns": "该 p5 物件" - }, - "p5.Element": { - "description": [ - "Clase base para todos los elementos añadidos al bosuqejo, incluyendo lienzo, buffers de gráficas, y otros elementos HTML. Los métodos en azul están incluidos en la funcionalidad base, los métodos en marrón son añadidos con la biblioteca p5.dom. No se ejecutan directamente, pero los objetos p5.Element son creados llamando a las funciones createCanvas(), createGraphics(), o en la biblioteca p5.dom, createDiv, createImg, createInput, etc." - ], - "params": { - "elt": "String: node DOM envolvente.", - "pInst": "Objeto: puntero a instancia p5." + "alpha": "数字:透明度", + "color": "数字[]|字符串|p5.Color:颜色数组、CSS 颜色字符串或 p5.Color 颜色值" + } } } } From 146ff5c3200fda9b93ffd13ce980d3f871130e33 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Tue, 18 Aug 2020 01:24:58 +0200 Subject: [PATCH 014/158] Fix "UNKNOWN-PARAM" keys --- src/data/reference/es.json | 118 ++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 66 deletions(-) diff --git a/src/data/reference/es.json b/src/data/reference/es.json index 06c5411d88..0f618e606a 100644 --- a/src/data/reference/es.json +++ b/src/data/reference/es.json @@ -95,11 +95,11 @@ "Crea colores para ser almacenados en variables del tipo color. Los parámetros son interpretados como valores RGB o HSB, dependiendo del modo actual de color según colorMode)(). El modo por defecto es RGB con valores entre 0 y 255 y, por lo tanto, la función color(255, 204, 0) retorna un color amarillo brillante. Nota que si solo se provee un valor a la función color(), será interpretado como un valor en escala de grises. Añade un segundo valor, y será usado como transparencia alpha. Cuando se especifican tres valores, son interpretados como valores RGB o HSB. Al añadir un cuarto valor se aplica transparencia alpha. Si se provee solo un parámetro de tipo string, será interpretado como un string de color compatible con CSS.Los colores son almacenados como números o arreglos." ], "params": { - "v1": "Número|String: número especificando el valor entre blanco y negro.", - "v2": "Número: valor de alpha relativo al rango de color actual (por defecto es 0-100)", - "v3": "Número|String: valor de rojo o tinte relativo al rango de color actual, o un string de color", - "alpha": "Número: valor de verde o saturación relativo al rango de color actual", - "UNKNOWN-PARAM-5": "Número: valor de azul o brillo relativo al rango de color actual" + "gray": "Número|String: número especificando el valor entre blanco y negro.", + "alpha": "Número: valor de alpha relativo al rango de color actual (por defecto es 0-100)", + "v1": "Número|String: valor de rojo o tinte relativo al rango de color actual, o un string de color", + "v2": "Número: valor de verde o saturación relativo al rango de color actual", + "v3": "Número: valor de azul o brillo relativo al rango de color actual" }, "returns": "Arreglo: color resultante" }, @@ -164,14 +164,14 @@ "La función background() define el color usado como fondo del lienzo p5.js. El fondo por defecto es gris claro. Esta función es típicamente usada dentro de draw() para despejar o borrar la ventana mostrada al inicio de cada cuadro, pero puede ser usada dentro de setup() para definir el fondo en el primer cuadro de la animación o si el fondo solo necesita ser definido una vez." ], "params": { - "v1": "Color: cualquier valor creado con la función color()", - "v2": "Número: opacidad del fondo relativo al rango de color actual (por defecto es 0-100)", - "v3": "colorstring: string de color, formatos posibles: enteros rgb() o rgba(), porcentajes rgb() o rgba(), hex 3 dígitos, hex 6 dígitos", - "a": "Número: especifica un valor entre blanco y negro", - "UNKNOWN-PARAM-5": "Número: valor de rojo o hue (dependiendo del modo de color actual)", - "UNKNOWN-PARAM-6": "Número: valor de verde o saturación (dependiendo del modo de color actual)", - "UNKNOWN-PARAM-7": "Número: valor de azul o brillo (dependiendo del modo de color actual)", - "UNKNOWN-PARAM-8": "p5.Image: imagen creada con loadImage() o createImage(), para ser definida como fondo (debe ser del mismo tamaño que la ventana del bosquejo)" + "color": "Color: cualquier valor creado con la función color()", + "a": "Número: opacidad del fondo relativo al rango de color actual (por defecto es 0-100)", + "colorstring": "colorstring: string de color, formatos posibles: enteros rgb() o rgba(), porcentajes rgb() o rgba(), hex 3 dígitos, hex 6 dígitos", + "gray": "Número: especifica un valor entre blanco y negro", + "v1": "Número: valor de rojo o hue (dependiendo del modo de color actual)", + "v2": "Número: valor de verde o saturación (dependiendo del modo de color actual)", + "v3": "Número: valor de azul o brillo (dependiendo del modo de color actual)", + "image": "p5.Image: imagen creada con loadImage() o createImage(), para ser definida como fondo (debe ser del mismo tamaño que la ventana del bosquejo)" }, "returns": "el objeto p5" }, @@ -308,8 +308,8 @@ "tr": "Número: radio opcional de la esquina superior derecha.", "br": "Número: radio opcional de la esquina inferior derecha.", "bl": "Número: radio opcional de la esquina inferior izquierda.", - "UNKNOWN-PARAM-9": "Número:", - "UNKNOWN-PARAM-10": "Número:" + "detailX": "Número:", + "detailY": "Número:" }, "returns": "el objeto p5" }, @@ -646,9 +646,8 @@ "params": { "radius": "Número: radio del anillo completo", "tubeRadius": "Número: radio del tubo", - "detailX": "Número: radio z del círculo", - "detailY": "Número: opcional, número de segmentos, a mayor número de segmentos la geometría es más suave, por defecto es 24.", - "UNKNOWN-PARAM-5": "Número: opcional, número de segmentos, a mayor número de segmentos la geometría es más suave, por defecto es 16." + "detailX": "Número: opcional, número de segmentos, a mayor número de segmentos la geometría es más suave, por defecto es 24.", + "detailY": "Número: opcional, número de segmentos, a mayor número de segmentos la geometría es más suave, por defecto es 16." }, "returns": "el objeto p5" }, @@ -930,8 +929,7 @@ ], "params": { "angle": "Ángulo: el ángulo de rotación, especificado en radianes o grados, dependiendo de angleMode()", - "axis": "Número: ángulo en radianes", - "UNKNOWN-PARAM-3": "p5.Vector|Arreglo: eje sobre el que se rota" + "axis": "p5.Vector|Arreglo: eje sobre el que se rota" }, "returns": "el objeto p5" }, @@ -1145,11 +1143,7 @@ "keyTyped": { "description": [ "la función keyTyped es llamada cava vez que una tecla es presionada, excepto cuando son presionadas la steclas de acción como Ctrl, Shift y Alt, que son ignoradas. La tecla presionada más reciente será almacenada en la variable key. Por la forma en que los sistemas operativos manejan la repetición de teclas, mantener presionada una tecla puede causar múltiples llamadas a keyTyped() (y también keyReleased()). La tasa de repetición es definida por el sistema operativo y según cómo cada computador está configurado. Los navegadores tienen distintos comportamientos por defecto asociados a distintos eventos gatillados por teclas. Para prevenir cualquier comportamiento por defecto para este evento, añade return false al final de este método." - ], - "params": { - "UNKNOWN-PARAM-1": "Número: el valor umbral" - }, - "returns": "el objeto p5" + ] }, "keyIsDown": { "description": [ @@ -1385,18 +1379,18 @@ ], "params": { "img": "p5.Image: la imagen a mostrar", - "dx": "Número: la coordenada x donde se ubicará la esquina superior de la imagen", - "dy": "Número: la coordenada y donde se ubicará la esquina superior de la imagen", - "dWidth": "Número: ancho de la imagen a dibujar", - "dHeight": "Número: altura de la imagen a dibujar", - "sx": "Número: la coordenada x en el lienzo de destino donde se ubicará la esquina superior izquierda de la imagen", - "sy": "Número: la coordenada y en el lienzo de destino donde se ubicará la esquina superior izquierda de la imagen", - "sWidth": "Número: ancho de la imagen a dibujar en el lienzo de destino", - "sHeight": "Número: altura de la imagen a dibujar en el lienzo de destino", - "UNKNOWN-PARAM-10": "Número: la coordenada x de la esquina superior izquierda del subrectángulo de la imagen original a dibujar en el lienzo de destino", - "UNKNOWN-PARAM-11": "Número: la coordenada y de la esquina superior izquierda del subrectángulo de la imagen original a dibujar en el lienzo de destino", - "UNKNOWN-PARAM-12": "Número: el ancho del subrectángulo de la imagen original a dibujar en el lienzo de destino", - "UNKNOWN-PARAM-13": "Número: la altura del subrectángulo de la imagen original a dibujar en el lienzo de destino" + "x": "Número: la coordenada x donde se ubicará la esquina superior de la imagen", + "y": "Número: la coordenada y donde se ubicará la esquina superior de la imagen", + "width": "Número: ancho de la imagen a dibujar", + "height": "Número: altura de la imagen a dibujar", + "dx": "Número: la coordenada x en el lienzo de destino donde se ubicará la esquina superior izquierda de la imagen", + "dy": "Número: la coordenada y en el lienzo de destino donde se ubicará la esquina superior izquierda de la imagen", + "dWidth": "Número: ancho de la imagen a dibujar en el lienzo de destino", + "dHeight": "Número: altura de la imagen a dibujar en el lienzo de destino", + "sx": "Número: la coordenada x de la esquina superior izquierda del subrectángulo de la imagen original a dibujar en el lienzo de destino", + "sy": "Número: la coordenada y de la esquina superior izquierda del subrectángulo de la imagen original a dibujar en el lienzo de destino", + "sWidth": "Número: el ancho del subrectángulo de la imagen original a dibujar en el lienzo de destino", + "sHeight": "Número: la altura del subrectángulo de la imagen original a dibujar en el lienzo de destino" }, "returns": "el objeto p5" }, @@ -1483,10 +1477,10 @@ "Retorna un arreglo de valores RGBA por cada pixel o toma una sección de una imagen. Si no especifican parámetros, se retorna la imagen entera. Usa los parámetros x e y para obtener el valor de un pixel. Toma una sección de la ventana mostrada si especificas los parámetros adicionales w y h. Cuando se obtiene una imagen, los parámetros x e y definen las coordenadas de la esquina superior izquierda de la imagen, sin importar el actual mode imagen definido por imageMode(). Si el pixel solicitado está fuera de la imagen, se retorna el valor [0, 0, 0, 255]. Para obtener los números escalados según los rangoes de color actuales y tomar en cuenta el modo de color según colorMode(), usa getColor() en vez de get(). Tomar el valor de un pixel con get(x, y) es fácil, pero no tan rápido como tomar los datos directamente desde pixels[]. La instrucción equivalente a get(x, y) usando pixels[] con densidad de pixeles d es var off = (y width + x) d * 4; [pixels[off], pixels[off+1], pixels[off+2], pixels[off+3]]. Ver la referencia de pixels[] para mayor información." ], "params": { - "the": "Número: coordenada x del pixel", - "UNKNOWN-PARAM-2": "Número: coordenada y del pixel", - "UNKNOWN-PARAM-3": "Número: ancho", - "UNKNOWN-PARAM-4": "Número: altura" + "x": "Número: coordenada x del pixel", + "y": "Número: coordenada y del pixel", + "w": "Número: ancho", + "h": "Número: altura" }, "returns": "Arreglo|p5.Image: valores de pixel en la posición (x, y) en formato arreglo RGBAs o p5.Image" }, @@ -1501,12 +1495,10 @@ "Cambia el color de cualquier pixel, o pone una imagen directamente en la ventana. Los parámetros x e y especifican el pixel a cambiar y c especifica el valor del color. Puede ser un objeto p5.Color o un arreglo de pixeles RGBA. También puede ser un valor único en escala de grises. Cuando se define una imagen, los parámetros x e y definen las coordenadas de la esquina superior izquierda de la imagen, sin importar el modo actual de imagen según imageMode(). Después de usar set(), debes llamar a updatePixels()' para que tus cambios aparezcan. Esta función debería ser llamada una vez que todos los pixeles han sido definidos. Definir el color de un solo pixel con set(x, y) es fácil, pero es tan rápido como poner los datos directamente en el arreglo pixels[]. Definir los valores de pixels[] directamente puede ser complicado cuando se trabaja con un monitor retina, pero tendrá un mejor desempeño cuando muchos pixeles necesiten ser definidos directamente en cada iteración. Ver la referencia de pixels[] para mayor información." ], "params": { - "key": "Número: coordenada x del pixel", - "value": "Número: coordenada x del pixel", - "UNKNOWN-PARAM-3": "Número: coordenada y del pixel", - "UNKNOWN-PARAM-4": "Número|Arreglo|Objeto: inserta un valor en escala de grises | un arreglo de pixeles | un objeto p5.Color | un objeto p5.Image a copiar" - }, - "returns": "el objeto p5" + "x": "Número: coordenada x del pixel", + "y": "Número: coordenada y del pixel", + "c": "Número|Arreglo|Objeto: inserta un valor en escala de grises | un arreglo de pixeles | un objeto p5.Color | un objeto p5.Image a copiar" + } }, "updatePixels": { "example": "", @@ -1620,9 +1612,9 @@ "Graba una imagen, text, json, csv, wav o html. Hace que la descarga ocurra en el computador cliente. Notar que no es recomendado llamar a save() dentro de draw() si está en bucle, porque la función save() abrirá una ventana de diálogo en cada cuadro. El comportamiento por defecto es grabar el lienzo como una imagen. Puedes opcionalmente especificar un nombre de archivo. Por ejemplo: TODO. Alternativamente, el primer parámetro puede ser un puntero a un lienzo p5.Element, un arreglo de Strings, un arreglo de JSON, un objeto JSON, un p5.Table, un p5.Image, o un p5.SoundFile (requiere p5.sound). El segundo parámetro es el nombre del archivo (incluyendo la extensión). El tercer parámetro es para opciones específicas a este tipo de objeto. Este método grabará un archivo que se austa a los parámetros dados. Por ejemplo: TODO. " ], "params": { - "filename": "Objeto|String: si se provee un nombre de archivo, se grabará el lienzo como una imagen con la extensión png o jpg, dependiendo del nombre del archivo. Si se provee un objeto, se grabará dependiendo del objeto y el nombre del archivo (ver los ejemplos anteriores)", - "extension": "String: Si se provee un objeto como el primer parámetro, entonces el segundo parámetro indica el nombre del archivo, y debe incluir la extensión apropiada (ver los ejemplos anteriores).", - "UNKNOWN-PARAM-3": "Boolean|String: opciones adicionales depndiendo del tipo de archivo. Por ejemplo, cuando se graba un archivo JSON, true indica que la salida será optimizada según el tamaño del archivo, en vez de por legibilidad." + "objectOrFilename": "Objeto|String: si se provee un nombre de archivo, se grabará el lienzo como una imagen con la extensión png o jpg, dependiendo del nombre del archivo. Si se provee un objeto, se grabará dependiendo del objeto y el nombre del archivo (ver los ejemplos anteriores)", + "filename": "String: Si se provee un objeto como el primer parámetro, entonces el segundo parámetro indica el nombre del archivo, y debe incluir la extensión apropiada (ver los ejemplos anteriores).", + "options": "Boolean|String: opciones adicionales depndiendo del tipo de archivo. Por ejemplo, cuando se graba un archivo JSON, true indica que la salida será optimizada según el tamaño del archivo, en vez de por legibilidad." }, "returns": "el objeto p5" }, @@ -2016,7 +2008,7 @@ "params": { "min": "Número: el límite inferior (inclusivo)", "max": "Número: el límite superio (exclusivo)", - "UNKNOWN-PARAM-3": "Arreglo: el arreglo del cual se elige" + "choices": "Arreglo: el arreglo del cual se elige" }, "returns": "Número: el número aleatorio o un elemento aleatorio de un conjunto de opciones" }, @@ -2419,10 +2411,9 @@ "v1": "Número|Arreglo|String|p5.Color: valor de gris, rojo o tinte (dependiendo del modo de color actual), o arreglo de color o String de color CSS", "v2": "Número: opcional, valor de verde o saturación", "v3": "Número: opcional, valor de azul o brillo", - "x": "Número: opcional, valor de opacidad", - "y": "Número|p5.Vector: dirección del eje x o un p5.Vector", - "z": "Número: opcional, dirección del eje y", - "UNKNOWN-PARAM-7": "Número: opcional, dirección del eje z" + "x": "Número|p5.Vector: dirección del eje x o un p5.Vector", + "y": "Número: opcional, dirección del eje y", + "z": "Número: opcional, dirección del eje z" }, "returns": "el objeto p5" }, @@ -2432,10 +2423,9 @@ "v1": "Número|Arreglo|String|p5.Color: valor de gris, rojo o tinte (dependiendo del modo de color actual), o arreglo de color o String de color CSS", "v2": "Número: opcional, valor de verde o saturación", "v3": "Número: opcional, valor de azul o brillo", - "x": "Número: opcional, valor de opacidad", - "y": "Número|p5.Vector: dirección del eje x o un p5.Vector", - "z": "Número: opcional, dirección del eje y", - "UNKNOWN-PARAM-7": "Número: opcional, dirección del eje z" + "x": "Número|p5.Vector: dirección del eje x o un p5.Vector", + "y": "Número: opcional, dirección del eje y", + "z": "Número: opcional, dirección del eje z" }, "returns": "p5: el objeto p5" }, @@ -2461,20 +2451,19 @@ "params": { "v1": "Número|Arreglo|String|p5.Color: valor de gris, rojo o tinte (dependiendo del modo de color), o arreglo de color, o String de color CSS", "v2": "Número: opcional, valor de verde o saturación", - "v3": "Número: opcional, valor de azul o brillo", - "UNKNOWN-PARAM-4": "Número: opcional, valor de opacidad" + "v3": "Número: opcional, valor de azul o brillo" }, "returns": "p5: el objeto p5" }, "specularMaterial": { "description": [ - "Material espejo para geometría con un color dado. Puedes ver todos los posibles materiales en este ejemplo (TODO)." + "Material espejo para geometría con un color dado. Puedes ver todos los posibles materiales en este ejemplo." ], "params": { "v1": "Número|Arreglo|String|p5.Color: valor de gris, rojo o tinte (dependiendo del modo de color), o arreglo de color, o String de color CSS", "v2": "Número: opcional, valor de verde o saturación", "v3": "Número: opcional, valor de azul o brillo", - "UNKNOWN-PARAM-4": "Número: opcional, valor de opacidad" + "alpha": "Número: opcional, valor de opacidad" }, "returns": "p5: el objeto p5" } @@ -2518,9 +2507,6 @@ "description": [ "XML es una representación de un objeto XML, capaz de procesar código XML. Usa loadXML() para cargar archivos externos XML y crear objetos XML" ], - "params": { - "UNKNOWN-PARAM-1": "String:" - }, "returns": "p5.XML: el objeto p5.XML generado" }, "p5.Vector": { From b4c0ad69fb19fba7d4172ef37a3db695f2f1df04 Mon Sep 17 00:00:00 2001 From: yukienomiya Date: Tue, 18 Aug 2020 01:25:47 +0200 Subject: [PATCH 015/158] Fix "UNKNOWN-PARAM" keys and delete empty strings --- src/data/reference/ko.json | 895 +++++++++++++------------------------ 1 file changed, 302 insertions(+), 593 deletions(-) diff --git a/src/data/reference/ko.json b/src/data/reference/ko.json index c46d0eff96..4a2f03b717 100644 --- a/src/data/reference/ko.json +++ b/src/data/reference/ko.json @@ -98,12 +98,12 @@ "색상 함수를 이용해 색상 데이터의 매개변수를 저장해보세요. 이 때, 매개변수는 colorMode()의 설정에 따라 RGB 또는 HSB 값으로 처리됩니다. 기본 모드인 RGB값은 0부터 255까지이며, 따라서 color(255,204,0)와 같은 함수는 밝은 노랑색을 반환하게 됩니다.

만약에 color() 함수에 매개변수가 1개만 적히면, 회색 음영(grayscale)값으로 처리됩니다. 여기에 추가되는 두번째 변수는 투명도를 설정할 수 있는 알파값으로서 처리됩니다. 세번째 변수가 추가되었을 때 비로소 RGB나 HSB값으로 처리되지요. RGB나 HSB값을 정하는 3개의 변수가 존재할 때 추가되는 네번째 변수는 알파값으로 적용됩니다.

나아가, p5는 RGB, RGBA, Hex CSS 색상 문자열과 모든 색상명 문자열 역시 지원합니다. 그 경우, 알파값은 괄호 내 2번째 매개변수 추가를 통해서가 아닌, RGBA 형식에 따라 지정될 수 있습니다." ], "params": { - "v1": "숫자: 흑과 백 사이의 값 지정", - "v2": "숫자: 현재 색상 범위(기본값: 0-255)에 대한 알파값)", - "v3": "숫자: 현재 색상 범위 내 빨강색(R) 또는 색조값 지정", - "alpha": "숫자: 현재 색상 범위 내 파랑색(B) 또는 색조값 지정", - "UNKNOWN-PARAM-5": "문자열: 색상 문자열", - "UNKNOWN-PARAM-6": "숫자[]: RGB 및 알파값을 포함한 숫자열" + "gray": "숫자: 흑과 백 사이의 값 지정", + "alpha": "숫자: 현재 색상 범위(기본값: 0-255)에 대한 알파값)", + "v1": "숫자: 현재 색상 범위 내 빨강색(R) 또는 색조값 지정", + "v3": "숫자: 현재 색상 범위 내 파랑색(B) 또는 색조값 지정", + "value": "문자열: 색상 문자열", + "values": "숫자[]: RGB 및 알파값을 포함한 숫자열" }, "returns": "색상 결과" }, @@ -168,15 +168,15 @@ "background() 함수는 p5.js 캔버스의 배경색을 설정합니다. 배경색의 기본값은 투명입니다. 이 함수는 주로 draw() 함수 안에 위치하며, 매 프레임마다 윈도우 화면을 초기화하기 위해 사용됩니다. 하지만, 애니메이션의 첫 프레임 배경을 지정하거나 배경색을 최초 한번만 지정할 경우, setup() 함수 안에 쓰이기도 합니다.
색상은 현재 색상 모드(colorMode)에 따라 RGB, HSB, 또는 HSL값으로 지정됩니다. (기본값으로 제공되는 색상 모드는 RGB이고, 그 색상 범위는 0부터 255까지 해당합니다.) 알파값의 기본 제공 범위 역시 0부터 255까지입니다.
단일한 문자열 인수에 대해 RGB, RGBA, Hex CSS 색상 문자열과 더불어 명명된 모든 색상 문자열이 지원됩니다. 단, 투명도인 알파값을 설정하기 위해서는 반드시 RGBA를 사용해야합니다.
p5.Color 객체를 통해 배경색을 설정할 수 있습니다.
p5.Image를 통해 배경 이미지를 설정할 수 있습니다." ], "params": { - "v1": "p5.Color: color() 함수로 생성된 모든 값", - "v2": "문자열, 지원되는 문자열 형식: 색상 문자열, 정수의 rgb()나 rgba(), 백분율의 rgb()나 rgba(), 3자리 숫자의 hex, 6자리 숫자의 hex", - "v3": "숫자: 현재 색상 범위에 따른 배경색 투명도 (기본값은 0-255) (선택 사항)", - "a": "숫자: 흑과 백 사이의 값 지정", - "UNKNOWN-PARAM-5": "숫자: 빨강값 또는 색조값 (현재 색상 모드에 따라 상이)", - "UNKNOWN-PARAM-6": "숫자: 초록값 또는 채도값 (현재 색상 모드에 따라 상이)", - "UNKNOWN-PARAM-7": "숫자: 파랑값 또는 밝기값 (현재 색상 모드에 따라 상이)", - "UNKNOWN-PARAM-8": "숫자 배열[]: 빨강값, 초록값, 파랑값, 알파값을 포함한 배열", - "UNKNOWN-PARAM-9": "p5.Image: loadImage()나 createImage()로 생성된 이미지를 배경 이미지로 설정하는 경우 (스케치 화면과 반드시 동일한 사이즈일 것)" + "color": "p5.Color: color() 함수로 생성된 모든 값", + "colorstring": "문자열, 지원되는 문자열 형식: 색상 문자열, 정수의 rgb()나 rgba(), 백분율의 rgb()나 rgba(), 3자리 숫자의 hex, 6자리 숫자의 hex", + "a": "숫자: 현재 색상 범위에 따른 배경색 투명도 (기본값은 0-255) (선택 사항)", + "gray": "숫자: 흑과 백 사이의 값 지정", + "v1": "숫자: 빨강값 또는 색조값 (현재 색상 모드에 따라 상이)", + "v2": "숫자: 초록값 또는 채도값 (현재 색상 모드에 따라 상이)", + "v3": "숫자: 파랑값 또는 밝기값 (현재 색상 모드에 따라 상이)", + "values": "숫자 배열[]: 빨강값, 초록값, 파랑값, 알파값을 포함한 배열", + "image": "p5.Image: loadImage()나 createImage()로 생성된 이미지를 배경 이미지로 설정하는 경우 (스케치 화면과 반드시 동일한 사이즈일 것)" }, "returns": "p5 객체" }, @@ -208,10 +208,10 @@ "v2": "숫자: 현재 지정된 색상 모드의 색상 범위에 따른 초록값 또는 채도값", "v3": "숫자:현재 지정된 색상 모드의 색상 범위에 따른 파랑값 또는 밝기값", "alpha": "숫자: (선택 사항)", - "UNKNOWN-PARAM-5": "문자열: 색상 문자열", - "UNKNOWN-PARAM-6": "숫자: 회색값", - "UNKNOWN-PARAM-7": "숫자 배열[]: 색상의 빨강값, 초록값, 파랑값, 그리고 알파값을 포함한 배열", - "UNKNOWN-PARAM-8": "p5.Color: 면채우기 색상" + "value": "문자열: 색상 문자열", + "gray": "숫자: 회색값", + "values": "숫자 배열[]: 색상의 빨강값, 초록값, 파랑값, 그리고 알파값을 포함한 배열", + "color": "p5.Color: 면채우기 색상" }, "returns": "p5 객체" }, @@ -236,10 +236,10 @@ "v2": "숫자: 현재 지정된 색상 모드의 색상 범위에 따른 초록값 또는 채도값", "v3": "숫자:현재 지정된 색상 모드의 색상 범위에 따른 파랑값 또는 밝기값", "alpha": "숫자: (선택 사항)", - "UNKNOWN-PARAM-5": "문자열: 색상 문자열", - "UNKNOWN-PARAM-6": "숫자: 회색값", - "UNKNOWN-PARAM-7": "숫자 배열[]: 색상의 빨강값, 초록값, 파랑값, 그리고 알파값을 포함한 배열", - "UNKNOWN-PARAM-8": "p5.Color: 선의 색상" + "value": "문자열: 색상 문자열", + "gray": "숫자: 회색값", + "values": "숫자 배열[]: 색상의 빨강값, 초록값, 파랑값, 그리고 알파값을 포함한 배열", + "color": "p5.Color: 선의 색상" }, "returns": "p5 객체" }, @@ -330,8 +330,8 @@ "tr": "숫자: 우측 상단 모퉁이 각도값. (선택 사항)", "br": "숫자: 우측 하단 모퉁이 각도값. (선택 사항)", "bl": "숫자: 좌측 하단 모퉁이 각도값. (선택 사항)", - "UNKNOWN-PARAM-9": "정수: x축 방향의 선분 수 (WebGL 모드용)", - "UNKNOWN-PARAM-10": "정수: y축 방향의 선분 수 (WebGL 모드용)" + "detailX": "정수: x축 방향의 선분 수 (WebGL 모드용)", + "detailY": "정수: y축 방향의 선분 수 (WebGL 모드용)" }, "returns": "p5 객체" }, @@ -361,8 +361,7 @@ "y2": "숫자:2번째 꼭지점의 y좌표값", "x3": "숫자:3번째 꼭지점의 x좌표값", "y3": "숫자:3번째 꼭지점의 y좌표값" - }, - "returns": "" + } }, "ellipseMode": { "description": [ @@ -370,14 +369,12 @@ ], "params": { "mode": "상수:CENTER, RADIUS, CORNER, 또는 CORNERS" - }, - "returns": "" + } }, "noSmooth": { "description": [ "모든 그래픽의 가장자리를 울퉁불퉁하게 처리합니다. smooth() 함수는 2D 모드상 언제나 기본값으로 활성화되며, 그래픽을 부드럽게 처리합니다. 따라서, noSmooth() 함수를 호출해야만 도형, 이미지, 폰트 등의 부드러운 처리를 비활성화할 수 있습니다. 반면, 3D 모드에서는 noSmooth()가 기본값으로 활성화됩니다. 따라서, smooth() 함수를 호출해야만 부드러운 처리가 가능합니다." - ], - "returns": "" + ] }, "rectMode": { "description": [ @@ -385,14 +382,12 @@ ], "params": { "mode": "상수:CORNER, CORNERS, CENTER 또는 RADIUS" - }, - "returns": "" + } }, "smooth": { "description": [ "모든 그래픽을 부드럽게 처리하며, 불러온 이미지 또는 크기가 재조정된 이미지의 화질을 향상합니다. smooth()는 2D 모드상 언제나 기본값으로 활성화되며. 따라서, noSmooth() 함수를 호출해야만 도형, 이미지, 폰트 등의 부드러운 그래픽 처리를 비활성화할 수 있습니다. 반면, 3D 모드에서는 noSmooth()가 기본값으로 활성화됩니다. 따라서, smooth() 함수를 호출해야만 부드러운 그래픽 처리가 가능합니다." - ], - "returns": "" + ] }, "strokeCap": { "description": [ @@ -400,8 +395,7 @@ ], "params": { "cap": "상수:SQUARE, PROJECT 또는 ROUND" - }, - "returns": "" + } }, "strokeJoin": { "description": [ @@ -409,8 +403,7 @@ ], "params": { "join": "상수:MITER, BEVEL 또는 ROUND" - }, - "returns": "" + } }, "strokeWeight": { "description": [ @@ -418,8 +411,7 @@ ], "params": { "weight": "숫자:선의 두께 (픽셀 단위)" - }, - "returns": "" + } }, "bezier": { "description": [ @@ -438,8 +430,7 @@ "x4": "숫자: 1번째 제어점의 z좌표값", "y4": "숫자: 2번째 제어점의 z좌표값", "z4": "숫자: 2번째 고정점의 z좌표값" - }, - "returns": "" + } }, "bezierDetail": { "description": [ @@ -447,8 +438,7 @@ ], "params": { "detail": "숫자: 곡선들의 해상도값" - }, - "returns": "" + } }, "bezierPoint": { "description": [ @@ -493,8 +483,7 @@ "x4": "숫자: 1번째 점의 z좌표값", "y4": "숫자: 2번째 점의 z좌표값", "z4": "숫자: 마지막 제어점의 z좌표값" - }, - "returns": "" + } }, "curveDetail": { "description": [ @@ -502,8 +491,7 @@ ], "params": { "resolution": "숫자: 곡선들의 해상도값" - }, - "returns": "" + } }, "curveTightness": { "description": [ @@ -511,8 +499,7 @@ ], "params": { "amount": "숫자: 원래 꼭지점으로부터 변형된 정도의 양" - }, - "returns": "" + } }, "curvePoint": { "description": [ @@ -543,8 +530,7 @@ "beginContour": { "description": [ "beginContour()와 endContour() 함수를 사용하여 특정 도형 내부에 그 음수 좌표에 상응하는 동일한 도형 윤곽선을 그릴 수 있습니다. 예를 들어, 동그라미의 안쪽에 또다른 작은 동그라미를 그릴 수 있습니다. beginContour()는 도형의 꼭지점을 기록하기 시작하고, endContour()는 그 기록을 중지합니다. 이 때, 안쪽의 도형을 정의하는 꼭지점은 바깥쪽의 도형과 반대 순서로 그려져야 합니다. 먼저 바깥에 위치한 원래 도형의 꼭지점을 시계 방향으로 그리고, 그 다음 내부의 도형을 시계 반대 방향으로 그립니다.

beginContour()/endContour() 함수는 반드시 beginShape()/endShape() 함수 사이에 작성되어야 합니다. 또한, beingContour()/endContour() 함수 사이에는 translate(), rotate(), scale()과 같은 변형 함수나 ellipse() 및 rect()와 같은 도형그리기 함수가 사용될 수 없습니다." - ], - "returns": "" + ] }, "beginShape": { "description": [ @@ -552,8 +538,7 @@ ], "params": { "kind": "상수: POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS 또는 QUAD_STRIP (선택 사항)" - }, - "returns": "" + } }, "bezierVertex": { "description": [ @@ -569,8 +554,7 @@ "x4": "숫자: 1번째 제어점의 z좌표값 (WebGL 모드용)", "y4": "숫자: 2번째 제어점의 z좌표값 (WebGL 모드용)", "z4": "숫자: 고정점의 z좌표값 (WebGL 모드용)" - }, - "returns": "" + } }, "curveVertex": { "description": [ @@ -580,14 +564,12 @@ "x": "숫자: 꼭지점의 x좌표값", "y": "숫자: 꼭지점의 y좌표값", "z": "숫자: 꼭지점의 z좌표값 (WebGL 모드용)(선택 사항)" - }, - "returns": "" + } }, "endContour": { "description": [ "beginContour()와 endContour() 함수를 사용하여 특정 도형 내부에 그 음수 좌표에 상응하는 동일한 도형 윤곽선을 그릴 수 있습니다. 예를 들어, 동그라미의 안쪽에 또다른 작은 동그라미를 그릴 수 있습니다. beginContour()는 도형의 꼭지점을 기록하기 시작하고, endContour()는 그 기록을 중지합니다. 이 때, 안쪽의 도형을 정의하는 꼭지점은 바깥쪽의 도형과 반대 순서로 그려져야 합니다. 먼저 바깥에 위치한 원래 도형의 꼭지점을 시계 방향으로 그리고, 그 다음 내부의 도형을 시계 반대 방향으로 그립니다.

beginContour()/endContour() 함수는 반드시 beginShape()/endShape() 함수 사이에 작성되어야 합니다. 또한, beingContour()/endContour() 함수 사이에는 translate(), rotate(), scale()과 같은 변형 함수나 ellipse() 및 rect()와 같은 도형그리기 함수가 사용될 수 없습니다." - ], - "returns": "" + ] }, "endShape": { "description": [ @@ -595,8 +577,7 @@ ], "params": { "mode": "상수: CLOSE로 도형 닫기(선택 사항)" - }, - "returns": "" + } }, "quadraticVertex": { "description": [ @@ -609,8 +590,7 @@ "x3": "숫자: 고정점의 y좌표값", "y3": "숫자: 제어점의 z좌표값 (WebGL 모드용)", "z3": "숫자: 고정점의 z좌표값 (WebGL 모드용)" - }, - "returns": "" + } }, "vertex": { "description": [ @@ -622,8 +602,7 @@ "z": "숫자: 꼭지점의 z좌표값", "u": "숫자: 꼭지점의 u좌표값(선택 사항)", "v": "숫자: 꼭지점의 v좌표값(선택 사항)" - }, - "returns": "" + } }, "plane": { "description": [ @@ -634,8 +613,7 @@ "height": "숫자: 평면의 높이값 (선택 사항)", "detailX": "정수: x-차원상의 삼각 세분면 개수 (선택 사항)", "detailY": "정수: y-차원상의 삼각 세분면 개수 (선택 사항)" - }, - "returns": "" + } }, "box": { "description": [ @@ -647,8 +625,7 @@ "depth": "숫자: 상자의 깊이값 (선택 사항)", "detailX": "정수: x-차원상의 삼각 세분면 개수 (선택 사항)", "detailY": "정수: y-차원상의 삼각 세분면 개수 (선택 사항)" - }, - "returns": "" + } }, "sphere": { "description": [ @@ -658,8 +635,7 @@ "radius": "숫자: 원의 반지름 (선택 사항)", "detailX": "정수: x-차원상의 삼각 세분면 (선택 사항)", "detailY": "정수: y-차원상의 삼각 세분면 (선택 사항)" - }, - "returns": "" + } }, "cylinder": { "description": [ @@ -671,8 +647,7 @@ "detailX": "정수: y-차원상의 세분면 개수, 기본값은 1 (선택 사항)", "detailY": "불리언: 원기둥의 밑바닥면을 그릴 지의 여부 (선택 사항)", "bottomCap": "불리언: 원기둥의 윗면을 그릴 지의 여부 (선택 사항)" - }, - "returns": "" + } }, "cone": { "description": [ @@ -684,8 +659,7 @@ "detailX": "정수: x-차원상의 세분면 개수, 기본값은 24 (선택 사항)", "detailY": "정수: y-차원상의 세분면 개수, 기본값은 1 (선택 사항)", "cap": "불리언: 원뿔의 밑바닥면을 그릴 지의 여부 (선택 사항)" - }, - "returns": "" + } }, "ellipsoid": { "description": [ @@ -696,8 +670,7 @@ "radiusy": "숫자: 타원면의 y-반지름값 (선택 사항)", "radiusz": "숫자: 타원면의 z-반지름값 (선택 사항)", "detailX": "정수: 세분면의 개수, 기본값은 24(선택 사항)" - }, - "returns": "" + } }, "torus": { "description": [ @@ -708,8 +681,7 @@ "tubeRadius": "숫자: 튜브의 반지름 (선택 사항)", "detailX": "정수: x-차원상의 세분면 개수, 기본값은 24 (선택 사항)", "detailY": "정수: y-차원상의 세분면 개수, 기본값은 16 (선택 사항)" - }, - "returns": "" + } }, "loadModel": { "description": [ @@ -729,50 +701,42 @@ ], "params": { "model": "p5.Geometry: 렌더링할, 불러온 3D 모델" - }, - "returns": "" + } }, "HALF_PI": { "description": [ "HALF_PI는 1.57079632679489661923 값을 갖는 상수입니다. 지름에 대한 원주율의 절반에 해당하며, 삼각 함수 sin()과 cos()와 함께 쓰면 더욱 유용합니다." - ], - "returns": "" + ] }, "PI": { "description": [ "PI는 3.14159265358979323846 값을 갖는 상수입니다. 지름에 대한 원주율을 의미하며, 삼각 함수 sin()과 cos()와 함께 쓰면 더욱 유용합니다." - ], - "returns": "" + ] }, "QUARTER_PI": { "description": [ "QUARTER_PI는 0.7853982 값을 갖는 상수입니다. 지름에 대한 원주율의 1/4에 해당하며, 삼각 함수 sin()과 cos()와 함께 쓰면 더욱 유용합니다." - ], - "returns": "" + ] }, "TAU": { "description": [ "TAU는 TWO_PI의 약어로, 이는 6.28318530717958647693 값을 갖는 상수입니다. 지름에 대한 원주율의 2배에 해당하며, 삼각 함수 sin()과 cos()와 함께 쓰면 더욱 유용합니다." - ], - "returns": "" + ] }, "TWO_PI": { "description": [ "TWO_PI는6.28318530717958647693 값을 갖는 상수입니다. 지름에 대한 원주율의 2배에 해당하며, 삼각 함수 sin()과 cos()와 함께 쓰면 더욱 유용합니다." - ], - "returns": "" + ] }, "DEGREES": { "description": [ "p5.js가 각도를 해석하고 계산하는 방법을 설정하기 위해, angleMode() 함수와 그 매개변수(DEGREES 또는 RADIANS)를 사용합니다." - ], - "returns": "" + ] }, "RADIANS": { "description": [ "p5.js가 각도를 해석하고 계산하는 방법을 설정하기 위해, angleMode() 함수와 그 매개변수(DEGREES 또는 RADIANS)를 사용합니다." - ], - "returns": "" + ] }, "print": { "description": [ @@ -780,20 +744,17 @@ ], "params": { "contents": "전부: 출력할 숫자, 문자열, 객체, 불리언, 배열의 조합" - }, - "returns": "" + } }, "frameCount": { "description": [ "시스템 변수 frameCount는 프로그램 시작 이후 화면에 나타난 프레임의 개수를 측정합니다. setup() 함수의 기본값은 0이고, draw() 함수의 첫번째 반복 실행이 마치면 1씩 증가하는 식입니다." - ], - "returns": "" + ] }, "focused": { "description": [ "p5.js 프로그램이 등장하는 화면창의 초점이 맞는지 여부를 확인하며, 이는 곧 스케치가 마우스나 키보드 입력을 허용한다는 것을 의미합니다. 화면창의 초점이 맞으면 변수는 true이고, 그렇지 않으면 false입니다." - ], - "returns": "" + ] }, "cursor": { "description": [ @@ -803,8 +764,7 @@ "type": "문자열|상수: ARROW, CROSS, HAND, MOVE, TEXT, WAIT. CSS 요소인 'grab', 'progress', 'cell' 등. 외부: 커서 이미지의 경로(허용 파일 확장자:.cur, .gif, .jpg, .jpeg, .png, url 주소. 참고: https://developer.mozilla.org/en-US/docs/Web/CSS/cursor", "x": "숫자: 커서의 수평 활성 지점 (32미만으로 지정) (선택 사항)", "y": "숫자: 커서의 수직 활성 지점 (32미만으로 지정) (선택 사항)" - }, - "returns": "" + } }, "frameRate": { "description": [ @@ -812,56 +772,47 @@ ], "params": { "fps": "숫자:매 초당 화면에 나타날 프레임 수" - }, - "returns": "" + } }, "noCursor": { "description": [ "화면상 커서를 숨깁니다." - ], - "returns": "" + ] }, "displayWidth": { "description": [ "pixelDensity() 함수의 기본값에 따라 화면의 너비값을 저장하는 시스템 변수입니다. 모든 디스플레이에서 프로그램을 전체 화면으로 실행시킬 때 사용합니다. 실제 화면 크기값을 반환하려면 여기에 pixelDensity를 곱하면 됩니다." - ], - "returns": "" + ] }, "displayHeight": { "description": [ "pixelDensity() 함수의 기본값에 따라 화면의 높이값을 저장하는 시스템 변수입니다. 모든 디스플레이에서 프로그램을 전체 화면으로 실행시킬 때 사용합니다. 실제 화면 크기값을 반환하려면 여기에 pixelDensity를 곱하면 됩니다." - ], - "returns": "" + ] }, "windowWidth": { "description": [ "사용자의 윈도우 화면 너비값을 저장해주는 시스템 변수로, window.innerWidth에 매핑됩니다." - ], - "returns": "" + ] }, "windowHeight": { "description": [ "사용자의 윈도우 화면 높이값을 저장해주는 시스템 변수로, window.innerHeight에 매핑됩니다." - ], - "returns": "" + ] }, "windowResized": { "description": [ "windowResized() 함수는 브라우저 창의 크기가 조정될 때마다 한 번씩 호출됩니다. 캔버스 크기를 재조정하거나 새 윈도우 화면의 크기에 맞춰 조정할 때 유용합니다." - ], - "returns": "" + ] }, "width": { "description": [ "생성된 캔버스의 너비값을 저장하는 시스템 변수입니다. 이 값은 createCanvas() 함수의 1번째 매개변수로서 지정됩니다. createCanvas(320, 240)는 너비 변수를 320으로 설정한 사례입니다. 프로그램에 createCanvase()를 사용하지 않을 경우, 너비는 기본값인 100으로 설정됩니다." - ], - "returns": "" + ] }, "height": { "description": [ "생성된 캔버스의 높이값을 저장하는 시스템 변수입니다. 이 값은 createCanvas() 함수의 2번째 매개변수로서 지정됩니다. createCanvas(320, 240)는 높이 변수를 240으로 설정한 사례입니다. 프로그램에 createCanvase()를 사용하지 않을 경우, 높이는 기본값인 100으로 설정됩니다." - ], - "returns": "" + ] }, "fullscreen": { "description": [ @@ -878,8 +829,7 @@ ], "params": { "val": "숫자: 스케치의 픽셀 크기를 조정할 지 여부 또는 조정값" - }, - "returns": "" + } }, "displayDensity": { "description": [ @@ -908,50 +858,42 @@ "preload": { "description": [ "preload() 함수는 setup() 함수 직전에 호출되며, 외부 파일의 비동기 불러오기를 차단하기 위해 사용됩니다. preload() 함수로 외부 파일 사전 불러오기가 설정되면, setup() 함수는 불러오기 호출이 완료될 때까지 대기합니다. 불러오기 호출 이외의 다른 함수(loadImage, loadJOSN, loadFont, loadString)는 preload() 함수 안에 포함되지 않아야 합니다. 만약 비동기 불러오기를 선호한다면, 불러오기 메소드를 setup() 함수 안에 포함시키거나, 그 외의 영역에서 callback 매개변수를 사용하여 호출하면 됩니다.
기본값으로 'loading..'이라는 텍스트가 화면에 나타납니다. 나만의 로딩 페이지를 만들려면 id가 p5_loading으로 지정된 HTML 요소를 추가하면 됩니다. 자세한 정보는 여기서 확인하세요." - ], - "returns": "" + ] }, "setup": { "description": [ "setup() 함수는 프로그램 실행시 단 한번 호출됩니다. 함수는 화면 크기나 배경색 등의 초기 환경 요소를 정의하고, 또 이미지나 폰트같은 미디어 파일을 불러오는 데에 쓰입니다. setup() 함수는 프로그램당 한 개씩만 존재할 수 있으며, 최초 한 번 실행된 이후에는 재호출되지 않아야 합니다.

참고: setup() 함수 안에 선언된 변수는, draw() 함수를 비롯한 여타 함수들이 접근할 수 없습니다." - ], - "returns": "" + ] }, "draw": { "description": [ "draw() 함수는 setup() 함수 직후에 호출되며, 프로그램 실행이 중단되거나 noLoop() 함수가 호출되기 전까지 블록 내에 포함된 코드들을 계속 실행합니다. 만약 setup() 함수에서 noLoop()가 호출된다면, draw() 함수는 단 한 번 실행됩니다. draw() 함수는 자동으로 호출되며, 명시적으로 호출하면 안됩니다.

draw() 함수는 항상 noLoop(), redraw(), 그리고 loop() 함수로 제어됩니다. noLoop()함수가 draw() 함수에 포함된 코드 실행을 멈추면, redraw() 함수가 draw() 함수 안에 포함된 코드들을 한 번만 실행하게 됩니다. loop() 함수의 경우, draw() 함수 안에 있는 코드를 계속해서 반복적으로 실행되게 합니다.

draw() 함수가 초당 호출되는 횟수는 frameRate() 함수를 통해 조정할 수 있습니다.

draw() 함수는 한 스케치당 한 번만 작성되어야 하며, 코드를 계속 실행하거나 mousePressed()와 같은 이벤트를 처리할 때 반드시 필요합니다. 때로는 위의 예제처럼 비어있는 draw() 함수를 호출하기도 합니다.

드로잉의 좌표계가 매 draw() 함수가 호출될 때마다 리셋되는 점에 유의하세요. draw() 함수 안에서 변형 함수(scale, rotate, translate)가 실행될 경우, draw() 함수가 재호출되는 시점에 그 효과들은 무효화되고, 따라서 시간이 지나도 변형 내용이 누적되지 않습니다. 반면, 한 번 선언된 스타일(fill, stroke 등)은 계속해서 적용됩니다." - ], - "returns": "" + ] }, "remove": { "description": [ "전체 p5 스케치를 제거합니다. 이 함수는 캔버스와 p5.js로 생성한 모든 요소들을 제거합니다. 또한, 그리기 반복(draw loop)를 중지하고, 윈도우 전역 범위에서 선언된 속성이나 메소드의 구속력을 해제합니다. 새로운 p5 스케치를 만들고자 할 경우에는 변수 p5를 남겨둡니다. 원한다면 p5 = null로 처리하여 이를 제거할 수 있습니다. p5 라이브러리로 생성한 모든 함수, 변수, 그리고 객체가 제거되지만, 사용자가 코드로 생성한 여타 전역 변수들은 그대로 유지됩니다." - ], - "returns": "" + ] }, "disableFriendlyErrors": { "description": [ "스케치를 만드는 동안 '친근한 에러 시스템(Friendly Error System, FES)'을 필요시 비활성화하여 성능을 향상시킵니다. 친근한 에러 시스템 비활성화하기를 참고하세요." - ], - "returns": "" + ] }, "noLoop": { "description": [ "p5.js가 draw() 함수 안에 포함된 코드를 계속 실행하지 않도록 합니다. loop() 함수가 호출될 경우, draw() 함수 안의 코드가 다시 계속 실행 됩니다. setup() 함수 안에 noLoop() 함수를 사용할 경우, setup() 함수 블록의 가장 마지막 줄에 작성합니다.

noLoop()을 사용하면, mousePressed()나 keyPressed()와 같은 이벤트 처리 함수를 통해 화면에 접근하거나 조정할 수 없습니다. 대신, redraw()나 loop() 함수들을 이용하여, 화면 업데이트 함수인 draw()를 재실행시켜 이벤트 처리 함수를 실행할 수 있습니다. 다시 말해, noLoop() 함수가 호출된다는 것은 draw()가 실행되지 않으며, saveFrame()이나 loadPixels()와 같은 함수 역시 사용할 수 없음을 뜻합니다.

스케치 크기를 재조정하면, noLoop() 함수가 호출되지 않더라도 redraw()가 호출되어 스케치를 업데이트하는 점에 유의하세요. 그렇지 않으면, 스케치는 loop()가 호출될 때까지 예기치 못한 반응을 보일 수 있습니다." - ], - "returns": "" + ] }, "loop": { "description": [ "기본값으로, p5.js는 draw() 함수 안에 포함된 코드를 계속해서 반복 실행(loop)합니다. 하지만, draw() 함수의 반복 실행 기능은 noLoop() 함수를 통해 중단될 수 있습니다. 그 경우, draw()의 반복 실행 기능은 loop() 함수를 통해 재개할 수 있습니다." - ], - "returns": "" + ] }, "push": { "description": [ "push() 함수는 현재의 드로잉 스타일 설정과 변형을 저장하고, pop() 함수는 이 설정들을 복구합니다. 이 함수들은 항상 함께 쓰이는 점에 유의하세요. 이 함수들을 통해 스타일과 변형 설정을 변경한 뒤에도 이전 설정 상태로 돌아갈 수 있습니다. push()와 pop() 함수들은 설정 사항에 대해 좀 더 많은 권한을 제공합니다. (두 번째 예제를 참고하세요.)

push()는 다음의 함수들을 통해 지정된 현재 변형 상태 및 스타일 설정 사항을 저장합니다: fill(), noFill(), noStroke(), stroke(), tint(), noTint(), strokeWeight(), strokeCap(), strokeJoin(), imageMode(), rectMode(), ellipseMode(), colorMode(), textAlign(), textFont(), textSize(), textLeading(), applyMatrix(), resetMatrix(), rotate(), scale(), shearX(), shearY(), translate(), noiseSeed().

WebGL 모드에서는 다음의 함수들을 통해 지정된, 더욱 다양한 스타일 설정 사항이 저장될 수 있습니다: setCamera(), ambientLight(), directionalLight(), pointLight(), texture(), specularMaterial(), shininess(), normalMaterial(), 그리고 shader()" - ], - "returns": "" + ] }, "pop": { "description": [ @@ -964,8 +906,7 @@ ], "params": { "n": "정수: n번 간 redraw() 함수 실행. 기본값은 1 (선택 사항)" - }, - "returns": "" + } }, "p5": { "description": [ @@ -974,8 +915,7 @@ "params": { "sketch": "객체: p5.js 스케치를 포함하는 함수", "node": "문자열|객체: 스케치를 포함할 HTML DOM 노드 ID 또는 포인터" - }, - "returns": "" + } }, "select": { "description": [ @@ -1001,8 +941,7 @@ "description": [ "createCanvase() 또는 createGraphics()로 생성된 캔버스와 그래픽을 제외하고, p5로 생성된 모든 요소를 제거합니다. 이벤트 핸들러 역시 제거되며, 요소가 DOM에서 제거됩니다." ], - "params": {}, - "returns": "" + "params": {} }, "changed": { "description": [ @@ -1010,8 +949,7 @@ ], "params": { "fxn": "함수|불리언: 요소값이 변경될 때 발생하는 함수. 거짓(false)이 전달되면 이전 실행 함수는 더이상 실행 불가" - }, - "returns": "" + } }, "input": { "description": [ @@ -1019,8 +957,7 @@ ], "params": { "fxn": "함수|불리언: 요소가 사용자 입력을 감지할 때 발생하는 함수. 거짓(false)이 전달되면 이전 실행 함수는 더이상 실행 불가" - }, - "returns": "" + } }, "createDiv": { "description": [ @@ -1110,7 +1047,7 @@ ], "params": { "multiple": "불리언: 드롭다운이 여러 개의 선택지를 제공할 경우 참(true) (선택 사항)", - "UNKNOWN-PARAM-2": "객체: DOM 셀렉트 요소" + "existing": "객체: DOM 셀렉트 요소" }, "returns": "p5.Element" }, @@ -1172,24 +1109,6 @@ }, "returns": "p5.MediaElement: 오디오 p5.Element에 대한 포인터" }, - "VIDEO": { - "description": [ - "" - ], - "params": { - "UNKNOWN-PARAM-1": "" - }, - "returns": "" - }, - "AUDIO": { - "description": [ - "" - ], - "params": { - "UNKNOWN-PARAM-1": "" - }, - "returns": "" - }, "createCapture": { "description": [ "웹캠의 오디오/비디오 피드를 담는