Skip to content

Commit 778cedb

Browse files
author
Lauren McCarthy
committed
adding hindi base for translation
1 parent 6f44c55 commit 778cedb

File tree

179 files changed

+11292
-1
lines changed

Some content is hidden

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

179 files changed

+11292
-1
lines changed

Gruntfile.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ module.exports = function(grunt) {
243243
src: ['**'],
244244
dest: '<%= config.dist %>/es/reference'
245245
},
246+
reference_hi: {
247+
expand: true,
248+
cwd: '<%= config.dist %>/reference',
249+
src: ['**'],
250+
dest: '<%= config.dist %>/hi/reference'
251+
},
246252
reference_zh_Hans: {
247253
expand: true,
248254
cwd: '<%= config.dist %>/reference',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"languages": [
66
"en",
77
"es",
8+
"hi",
89
"zh-Hans"
910
],
1011
"homepage": "https://github.com/processing/p5.js-website",
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* @name Coordinates
3+
* @description All shapes drawn to the screen have a position that is
4+
* specified as a coordinate. All coordinates are measured as the distance from
5+
* the origin in units of pixels. The origin [0, 0] is the coordinate in the
6+
* upper left of the window and the coordinate in the lower right is [width-1,
7+
* height-1].
8+
*/
9+
function setup() {
10+
// Sets the screen to be 720 pixels wide and 400 pixels high
11+
createCanvas(720, 400);
12+
}
13+
14+
function draw() {
15+
// Set the background to black and turn off the fill color
16+
background(0);
17+
noFill();
18+
19+
// The two parameters of the point() method each specify
20+
// coordinates.
21+
// The first parameter is the x-coordinate and the second is the Y
22+
stroke(255);
23+
point(width * 0.5, height * 0.5);
24+
point(width * 0.5, height * 0.25);
25+
26+
// Coordinates are used for drawing all shapes, not just points.
27+
// Parameters for different functions are used for different
28+
// purposes. For example, the first two parameters to line()
29+
// specify the coordinates of the first endpoint and the second
30+
// two parameters specify the second endpoint
31+
stroke(0, 153, 255);
32+
line(0, height * 0.33, width, height * 0.33);
33+
34+
// By default, the first two parameters to rect() are the
35+
// coordinates of the upper-left corner and the second pair
36+
// is the width and height
37+
stroke(255, 153, 0);
38+
rect(width * 0.25, height * 0.1, width * 0.5, height * 0.8);
39+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* @name Width and Height
3+
* @description The 'width' and 'height' variables contain the
4+
* width and height of the display window as defined in the createCanvas()
5+
* function.
6+
*/
7+
function setup() {
8+
createCanvas(720, 400);
9+
}
10+
11+
function draw() {
12+
background(127);
13+
noStroke();
14+
for (let i = 0; i < height; i += 20) {
15+
fill(129, 206, 15);
16+
rect(0, i, width, 10);
17+
fill(255);
18+
rect(i, 0, 10, height);
19+
}
20+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* @name Setup and Draw
3+
* @description The code inside the draw() function runs continuously from top
4+
* to bottom until the program is stopped.
5+
*/
6+
let y = 100;
7+
8+
// The statements in the setup() function
9+
// execute once when the program begins
10+
function setup() {
11+
// createCanvas must be the first statement
12+
createCanvas(720, 400);
13+
stroke(255); // Set line drawing color to white
14+
frameRate(30);
15+
}
16+
// The statements in draw() are executed until the
17+
// program is stopped. Each statement is executed in
18+
// sequence and after the last line is read, the first
19+
// line is executed again.
20+
function draw() {
21+
background(0); // Set the background to black
22+
y = y - 1;
23+
if (y < 0) {
24+
y = height;
25+
}
26+
line(0, y, width, y);
27+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* @name No Loop
3+
* @description The noLoop() function causes draw() to only execute once.
4+
* Without calling noLoop(), the code inside draw() is run continually.
5+
*/
6+
let y;
7+
8+
// The statements in the setup() function
9+
// execute once when the program begins
10+
function setup() {
11+
// createCanvas should be the first statement
12+
createCanvas(720, 400);
13+
stroke(255); // Set line drawing color to white
14+
noLoop();
15+
16+
y = height * 0.5;
17+
}
18+
19+
// The statements in draw() are executed until the
20+
// program is stopped. Each statement is executed in
21+
// sequence and after the last line is read, the first
22+
// line is executed again.
23+
function draw() {
24+
background(0); // Set the background to black
25+
y = y - 1;
26+
if (y < 0) {
27+
y = height;
28+
}
29+
line(0, y, width, y);
30+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* @name Loop
3+
* @description The code inside the draw() function runs continuously from top
4+
* to bottom until the program is stopped.
5+
*/
6+
let y = 100;
7+
8+
// The statements in the setup() function
9+
// execute once when the program begins
10+
function setup() {
11+
createCanvas(720, 400); // Size must be the first statement
12+
stroke(255); // Set line drawing color to white
13+
frameRate(30);
14+
}
15+
// The statements in draw() are executed until the
16+
// program is stopped. Each statement is executed in
17+
// sequence and after the last line is read, the first
18+
// line is executed again.
19+
function draw() {
20+
background(0); // Set the background to black
21+
y = y - 1;
22+
if (y < 0) {
23+
y = height;
24+
}
25+
line(0, y, width, y);
26+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* @name Redraw
3+
* @description The redraw() function makes draw() execute once. In this example,
4+
* draw() is executed once every time the mouse is clicked.
5+
*/
6+
7+
let y;
8+
9+
// The statements in the setup() function
10+
// execute once when the program begins
11+
function setup() {
12+
createCanvas(720, 400);
13+
stroke(255);
14+
noLoop();
15+
y = height * 0.5;
16+
}
17+
18+
// The statements in draw() are executed until the
19+
// program is stopped. Each statement is executed in
20+
// sequence and after the last line is read, the first
21+
// line is executed again.
22+
function draw() {
23+
background(0);
24+
y = y - 4;
25+
if (y < 0) {
26+
y = height;
27+
}
28+
line(0, y, width, y);
29+
}
30+
31+
function mousePressed() {
32+
redraw();
33+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
*@name Functions
3+
*@description The drawTarget() function makes it easy to draw many distinct
4+
*targets. Each call to drawTarget() specifies the position, size, and number of
5+
*rings for each target.
6+
*/
7+
8+
function setup() {
9+
createCanvas(720, 400);
10+
background(51);
11+
noStroke();
12+
noLoop();
13+
}
14+
15+
function draw() {
16+
drawTarget(width * 0.25, height * 0.4, 200, 4);
17+
drawTarget(width * 0.5, height * 0.5, 300, 10);
18+
drawTarget(width * 0.75, height * 0.3, 120, 6);
19+
}
20+
21+
function drawTarget(xloc, yloc, size, num) {
22+
const grayvalues = 255 / num;
23+
const steps = size / num;
24+
for (let i = 0; i < num; i++) {
25+
fill(i * grayvalues);
26+
ellipse(xloc, yloc, size - i * steps, size - i * steps);
27+
}
28+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
*@name Recursion
3+
*@description A demonstration of recursion, which means functions call themselves.
4+
* Notice how the drawCircle() function calls itself at the end of its block.
5+
* It continues to do this until the variable "level" is equal to 1.
6+
*/
7+
8+
function setup() {
9+
createCanvas(720, 400);
10+
noStroke();
11+
noLoop();
12+
}
13+
14+
function draw() {
15+
drawCircle(width / 2, 280, 6);
16+
}
17+
18+
function drawCircle(x, radius, level) {
19+
const tt = (126 * level) / 4.0;
20+
fill(tt);
21+
ellipse(x, height / 2, radius * 2, radius * 2);
22+
if (level > 1) {
23+
level = level - 1;
24+
drawCircle(x - radius / 2, radius / 2, level);
25+
drawCircle(x + radius / 2, radius / 2, level);
26+
}
27+
}

0 commit comments

Comments
 (0)