Skip to content

Commit d235493

Browse files
committed
update with processing website
2 parents 1119029 + 667d745 commit d235493

File tree

1,190 files changed

+125501
-43169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,190 files changed

+125501
-43169
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ module.exports = function(grunt) {
316316
});
317317

318318
grunt.loadNpmTasks('grunt-exec');
319-
grunt.loadNpmTasks('assemble');
319+
grunt.loadNpmTasks('grunt-assemble');
320320
grunt.loadNpmTasks('grunt-file-append');
321321
grunt.loadNpmTasks('grunt-contrib-compress');
322322
grunt.loadNpmTasks('grunt-contrib-requirejs');

README.md

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,64 +19,62 @@ Once you've setup the site, to run again in the future:
1919
## File structure
2020

2121
* __See note about what to include in pull requests [here](https://github.com/processing/p5.js-website/wiki/Pull-requests).__
22-
* `src` – All the pieces for generating the built site. __Edits should be made here.__
23-
* `assets` – All static files (imgs, css, fonts, js, p5_featured homepage sketches)
22+
* `src/` – All the pieces for generating the built site. __Edits should be made here.__
23+
* `assets/` – All static files (imgs, css, fonts, js, p5_featured homepage sketches)
2424
* Note: if you make edits here you must restart the server to see your changes. To see changes immediately, you can edit the assets files in the dist directory, but need to copy and paste your updated work here for it to be saved.
25-
* `data` – translation files
26-
* `templates`
27-
* `layouts` – default.hbs is main page template
28-
* `pages` – Contains each of the pages of the p5 site, these get inserted in `{{> body }}` tag of default layout.
29-
* `partials` – These are reusable pieces that can get added to any page or layout, they correspond to other `{{> filename }}` tags in the pages or default layout.
30-
* `dist` – Where the rendered files are stored, this can be placed directly online.
25+
* `data/` – translation files
26+
* `templates/`
27+
* `layouts/` – default.hbs is main page template
28+
* `pages/` – Contains each of the pages of the p5 site, these get inserted in `{{> body }}` tag of default layout.
29+
* `partials/` – These are reusable pieces that can get added to any page or layout, they correspond to other `{{> filename }}` tags in the pages or default layout.
30+
* `dist/` – Where the rendered files are stored, this can be placed directly online.
3131
* `Gruntfile.js` – This file contains all the tasks for using assemble and YAML to generate the final, static site. It uses the taskrunner [grunt](http://gruntjs.com/).
3232

3333
## Internationalization (i18n) and structure
3434

35-
### When adding a new language:
36-
37-
1. Duplicate `[en.yml]`(https://github.com/processing/p5.js-website/blob/master/src/data/en.yml) in `src/data` and name it `{languageabbreviation}.yml`. For example `es.yml`. See this page for [two-letter language abbreviations](https://www.abbreviations.com/acronyms/LANGUAGES2L).
38-
2. Duplicate `[es.json]`(https://github.com/processing/p5.js-website/blob/master/src/data/reference/es.json) and name it `{languageabbreviation}.json`.
39-
3. Add an entry with the language abbreviation [here](https://github.com/processing/p5.js-website/blob/master/Gruntfile.js#L90).
40-
41-
### YAML (non-reference page translation)
35+
### Translation for all pages except Reference (YML)
4236

4337
* Each website page uses handlebars to access the i18n data and render. The .yml files in the `src/data` folder hold the i18n data for each language. Within the pages there are tags that look like this: `{{#i18n "MyKeyword"}}{{/i18n}}`
4438
* MyKeyword corresponds to the key-value pair for the translation of that word or phrase. There should be a MyKeyword entry in every language file for things to render correctly.
4539
* Each page contains YAML "front matter" at the top which includes a title and (optional) slug field. The title corresponds to the section in which to place the i18n key-value pairs. (Note: each page has only one title, so for partials within the `partials` folder, place the i18n pairs at the top level.)
4640
* The slug corresponds to the folder in which the page will be placed. This should generally match the folder structure within the `pages` folder.
47-
* For english version, the site will follow the same top-level hierarchy as the original site. When you switch to a different language, the permalink and file structure will include a two letter abbreviation immediately following the root url. (ex: `https://p5js.org/es/get-started/`)
48-
49-
### JSON (reference)
41+
* For English version, the site will follow the same top-level hierarchy as the original site. When you switch to a different language, the permalink and file structure will include the language abbreviation immediately following the root url. (ex: `https://p5js.org/es/get-started/`)
42+
43+
### Translation for Reference (JSON)
5044

5145
* The reference works a bit differently. The pages are built in English based on the inline documentation in the source code. They are then swapped out using [JS on the front-end](https://github.com/processing/p5.js-website/blob/master/dist/reference/index.html#L130).
5246
* The top level keys in the JSON object correspond to the page headings, menu, footer, etc. You can see all the swaps in [this file](https://github.com/processing/p5.js-website/blob/master/dist/reference/index.html#L130).
5347
* The "p5" key in the JSON object contains individual keys for each reference entry, indexed by variable/function/object name.
5448
* Any entries in the JSON object which are not filled in will be left in English when the page is loaded.
5549
* This is a somewhat hacky solution and not ideal. However, it comes from balancing the desire to have documentation directly in the source code, with the unwieldiness of having multiple languages of documentation inline. It will be our working solution until a better one is found.
56-
57-
### Introducción a p5.js
58-
The repository for the book and PDF production of Introducción a p5.js can be found [here](https://github.com/processing/p5.js-getting-started-es).
59-
60-
## Updating the reference
50+
* The source content for the reference is handled inline in the [p5.js source code](https://github.com/processing/p5.js). See [Inline documentation](https://github.com/processing/p5.js/blob/master/developer_docs/inline_documentation.md) in the p5.js repo for information on how to contribute.
6151

62-
The documentation for p5.js is handled inline in the source code. See [Inline documentation](https://github.com/processing/p5.js/blob/master/developer_docs/inline_documentation.md) in the p5.js repo for information on how to contribute.
63-
64-
## Notes about Examples
52+
## Notes about translating Examples
6553

6654
The examples are handled a bit differently from other pages.
67-
6855
* All examples pages are built from `src/data/examples`.
69-
* Within the examples folder, there is a folder for each of the three languages we currently support: 'en/', 'es/', and 'zh-Hans/'. When adding a new example, first add an English version of the file to the `en/` folder, then make sure it is duplicated in the same place in all other languages, then translate for whichever languages you can. If you have created a new folder, add entries to the YAML files with the foldername as the key.
56+
* Within the examples folder, there is a folder for each of the three languages we currently support: `en/`, `es/`, and `zh-Hans/`. When adding a new example, first add an English version of the file to the `en/` folder, then make sure it is duplicated in the same place in all other languages, then translate for whichever languages you can. If you have created a new folder, add entries to the YAML files with the foldername as the key.
7057
* The folder, file, and numbering structure should match exactly between the different languages. Do not change the filenames. The text for the example name, description, and source code are all in the .js files in the folders.
7158
* Assets for the examples are placed in `src/data/examples/assets`.
7259
* Translations for the topic headers on the example index page are done in the YAML files (`src/data/*.yml`).
7360

74-
## Documentation
61+
### Adding a new language
62+
63+
1. Duplicate `[en.yml]`(https://github.com/processing/p5.js-website/blob/master/src/data/en.yml) in `src/data` and name it `{languageabbreviation}.yml`. For example `es.yml`. See this page for [two-letter language abbreviations](https://www.abbreviations.com/acronyms/LANGUAGES2L).
64+
2. Duplicate `[es.json]`(https://github.com/processing/p5.js-website/blob/master/src/data/reference/es.json) and name it `{languageabbreviation}.json`.
65+
3. Add an entry with the language abbreviation [here](https://github.com/processing/p5.js-website/blob/master/Gruntfile.js#L90).
66+
67+
68+
## Tools
7569

7670
* [Assemble](http://assemble.io/) is used to build a static site out of all the layouts and yml data.
7771
* [grunt-assemble-i18n](https://github.com/assemble/grunt-assemble-i18n) renders a set of pages for each language specified in the gruntfile, based on the handlebars templates and yml data. There is not a lot of documentation, but this [example](https://github.com/LaurentGoderre/i18n-demo) demonstrates the functionality well.
7872
* [assemble-contrib-permalinks](https://github.com/assemble/assemble-permalinks) allows us to customize the permalinks (file structure of the rendered static site).
7973

80-
## Etc
74+
## Add yourself to contributors!
75+
76+
If you've contributed to this website (or any other part of the p5.js project), add yourself [here](https://github.com/processing/p5.js#contributors). Instructions to do this can be found at the bottom of the section.
8177

82-
* If you are using sublime text, this plugin is useful for rendering hbs files with syntax highlighting: https://github.com/jonschlinkert/sublime-markdown-extended
78+
79+
## Etc
80+
* Introducción a p5.js - The repository for the book and PDF production of Introducción a p5.js can be found [here](https://github.com/processing/p5.js-getting-started-es).

dist/assets/css/all.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/css/maps/all.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"bubbles": [
3+
{
4+
"position": {
5+
"x": 160,
6+
"y": 103
7+
},
8+
"diameter": 43.19838,
9+
"label": "Happy"
10+
},
11+
{
12+
"position": {
13+
"x": 372,
14+
"y": 137
15+
},
16+
"diameter": 52.42526,
17+
"label": "Sad"
18+
}
19+
]
20+
}
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
/*
2-
* @name Arctangent.
3-
* @frame 720,400
4-
* Move the mouse to change the direction of the eyes. The atan2()
5-
* function computes the angle from each eye to the cursor.
2+
* @name Arctangent
3+
* @description Move the mouse to change the direction of the eyes.<br>The atan2() function computes the angle from each eye to the cursor.
64
*/
7-
85
var e1, e2, e3;
96

107
function setup() {
@@ -17,28 +14,25 @@ function setup() {
1714

1815
function draw() {
1916
background(102);
20-
2117
e1.update(mouseX, mouseY);
2218
e2.update(mouseX, mouseY);
2319
e3.update(mouseX, mouseY);
24-
2520
e1.display();
2621
e2.display();
2722
e3.display();
2823
}
2924

3025
function Eye(tx, ty, ts) {
31-
this.angle = 0.0;
3226
this.x = tx;
3327
this.y = ty;
3428
this.size = ts;
29+
this.angle = 0;
3530

36-
console.log(this);
37-
this.update = function(mx, my) {
31+
this.update = function (mx, my) {
3832
this.angle = atan2(my - this.y, mx - this.x);
3933
};
4034

41-
this.display = function() {
35+
this.display = function () {
4236
push();
4337
translate(this.x, this.y);
4438
fill(255);
@@ -48,4 +42,4 @@ function Eye(tx, ty, ts) {
4842
ellipse(this.size / 4, 0, this.size / 2, this.size / 2);
4943
pop();
5044
};
51-
}
45+
}

dist/assets/examples/en/08_Math/10_Interpolate.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* @name Linear Interpolation.
3-
* @frame 720,400
4-
* Move the mouse across the screen and the symbol will follow.
2+
* @name Linear Interpolation
3+
* @frame 720, 400
4+
* @description Move the mouse across the screen and the symbol will follow.
55
* Between drawing each frame of the animation, the ellipse moves part
66
* of the distance (0.05) from its current position toward the cursor using
7-
* the lerp() function * This is the same as the Easing under input only with
8-
* lerp() instead..
7+
* the lerp() function.
8+
* This is the same as the Easing under input only with lerp() instead..
99
*/
1010

1111
var x = 0;

dist/assets/examples/en/08_Math/15_arctangent.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

dist/assets/examples/en/13_Motion/04_Moving_On_Curves.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

dist/assets/examples/en/13_Motion/05_Moving_On_Curves.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)