Skip to content

Commit ad1af8d

Browse files
committed
Merge branch 'master' of github.com:processing/p5.js-website
2 parents 967017e + b2026d7 commit ad1af8d

Some content is hidden

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

46 files changed

+311
-340
lines changed

src/assets/css/main.css

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ div.reference-subgroup {
455455

456456
.paramname {
457457
display: inline-block;
458-
width: 8em;
458+
width: 33%;
459459
font-size: 1.2em;
460460
}
461461

@@ -467,7 +467,7 @@ div.reference-subgroup {
467467
.paramtype {
468468
display: inline-block;
469469
font-size: 1.2em;
470-
width: 20em;
470+
width: 66%;
471471
vertical-align: top;
472472
}
473473

@@ -2414,15 +2414,15 @@ iframe {
24142414

24152415
#get-started-page #asterisk-design-element,
24162416
#community-page #asterisk-design-element {
2417-
top: -30%;
2418-
right: -40%;
2419-
height: 44em;
2420-
width: 44em;
2421-
-webkit-transform: rotate(9deg);
2422-
-moz-transform: rotate(9deg);
2423-
-ms-transform: rotate(9deg);
2424-
-o-transform: rotate(9deg);
2425-
transform: rotate(9deg);
2417+
top: 10%;
2418+
right: -20%;
2419+
height: 30em;
2420+
width: 30em;
2421+
-webkit-transform: rotate(2deg);
2422+
-moz-transform: rotate(2deg);
2423+
-ms-transform: rotate(2deg);
2424+
-o-transform: rotate(2deg);
2425+
transform: rotate(2deg);
24262426
}
24272427

24282428
#reference-page #asterisk-design-element,

src/assets/js/render.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,18 @@ var renderCode = function(exampleName) {
152152
edit_area.style.display = 'block';
153153
edit_area.focus();
154154
} else {
155-
$('.example_container').each(function(ind, con) {
156-
$(con).css('opacity', 1.0);
157-
$(con).removeClass('editing');
158-
});
159155
edit_button.innerHTML = 'edit';
160156
edit_area.style.display = 'none';
161157
sketch.textContent = edit_area.value;
158+
$('.example_container').each(function (ind, con) {
159+
$(con).css('opacity', 1.0);
160+
$(con).removeClass('editing');
161+
$this = $(this);
162+
var pre = $this.find('pre')[0];
163+
if (pre) {
164+
$this.height(Math.max($(pre).height(), 100) + 20);
165+
}
166+
});
162167
runCode(sketch, true, i);
163168
}
164169
}

src/data/en.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ home:
3535
p1x1: "p5.js is a JavaScript library for creative coding, with a focus on making coding accessible and inclusive for artists, designers, educators, beginners, and anyone else! p5.js is free and open-source because we believe software, and the tools to learn it, should be accessible to everyone."
3636
p1x2: "Using the metaphor of a sketch, p5.js has a full set of drawing functionality. However, you’re not limited to your drawing canvas. You can think of your whole browser page as your sketch, including HTML5 objects for text, input, video, webcam, and sound."
3737
p2xh2: "Community"
38-
p2x1: "We are a community of, and in solidarity with, people from every gender identity and expression, sexual orientation, race, ethnicity, language, neuro-type, size, ability, class, religion, culture, subculture, political opinion, age, skill level, occupation, and background. We acknowledge that not everyone has the time, financial means, or capacity to actively participate, but we recognize and encourage involvement of all kinds. We facilitate and foster access and empowerment. We are all learners."
38+
p2x1: "We are a community of, and in solidarity with, people from every gender identity and expression, sexual orientation, race, ethnicity, language, neuro-type, size, disability, class, religion, culture, subculture, political opinion, age, skill level, occupation, and background. We acknowledge that not everyone has the time, financial means, or capacity to actively participate, but we recognize and encourage involvement of all kinds. We facilitate and foster access and empowerment. We are all learners."
3939
p2x2: "p5.js is an interpretation of "
4040
p2x3: " for today’s web. We hold events and operate with support from the "
4141
p2x4: "."

src/data/examples/es/08_Math/10_Interpolate.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* @name Linear Interpolation
2+
* @name Interpolación Lineal
33
* @frame 720, 400
4-
* @description Move the mouse across the screen and the symbol will follow.
5-
* Between drawing each frame of the animation, the ellipse moves part
6-
* of the distance (0.05) from its current position toward the cursor using
7-
* the lerp() function.
8-
* This is the same as the Easing under input only with lerp() instead..
4+
* @description Mueve el ratón a través de la pantalla y el símbolo le seguirá.
5+
* Entre cada fotograma de la animación, la elipse se mueve parte
6+
* de la distancia (0,05) desde su posición actual hacia el cursor
7+
* usando la función lerp().
8+
* Esto es equivalente al uso de Easing en la sección Input, sólo que con lerp() en su lugar...
99
*/
1010

1111
let x = 0;
@@ -19,12 +19,12 @@ function setup() {
1919
function draw() {
2020
background(51);
2121

22-
// lerp() calculates a number between two numbers at a specific increment.
23-
// The amt parameter is the amount to interpolate between the two values
24-
// where 0.0 equal to the first point, 0.1 is very near the first point, 0.5
25-
// is half-way in between, etc.
22+
// lerp() calcula un número entre dos números en un incremento específico.
23+
// El parámetro amt (amount) es la cantidad a interpolar entre los dos valores
24+
// donde 0,0 es igual al primer punto, 0,1 está muy cerca del primer punto, 0,5
25+
// está a mitad de camino, etc.
2626

27-
// Here we are moving 5% of the way to the mouse location each frame
27+
// Aquí estamos moviendo el 5% del camino hacia la ubicación del ratón en cada fotograma
2828
x = lerp(x, mouseX, 0.05);
2929
y = lerp(y, mouseY, 0.05);
3030

src/data/examples/es/08_Math/15_Noise2D.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* @name Noise2D
2+
* @name Ruido 2D
33
* @frame 710,400 (optional)
4-
* @description Create a 2D noise with different parameters.
4+
* @description Crear un ruido 2D con parámetros diferentes.
55
*
66
*/
77

@@ -14,27 +14,27 @@ function setup() {
1414

1515
function draw() {
1616
background(0);
17-
// Draw the left half of image
17+
// Dibujar la mitad izquierda de la imagen
1818
for (let y = 0; y < height - 30; y++) {
1919
for (let x = 0; x < width / 2; x++) {
20-
// noiceDetail of the pixels octave count and falloff value
20+
// noiceDetail (detalle del ruido) del número de octavas y valor de caída de los píxeles
2121
noiseDetail(2, 0.2);
2222
noiseVal = noise((mouseX + x) * noiseScale, (mouseY + y) * noiseScale);
2323
stroke(noiseVal * 255);
2424
point(x, y);
2525
}
2626
}
27-
// Draw the right half of image
27+
// Dibujar la mitad derecha de la imagen
2828
for (let y = 0; y < height - 30; y++) {
2929
for (let x = width / 2; x < width; x++) {
30-
// noiceDetail of the pixels octave count and falloff value
30+
// noiceDetail (detalle del ruido) del número de octavas y valor de caída de los píxeles
3131
noiseDetail(5, 0.5);
3232
noiseVal = noise((mouseX + x) * noiseScale, (mouseY + y) * noiseScale);
3333
stroke(noiseVal * 255);
3434
point(x, y);
3535
}
3636
}
37-
//Show the details of two partitions
37+
//Mostrar los detalles de las dos particiones
3838
textSize(18);
3939
fill(255, 255, 255);
4040
text('Noice2D with 2 octaves and 0.2 falloff', 10, 350);

src/data/examples/es/08_Math/16_Noise3D.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
/*
2-
* @name Noise3D
2+
* @name Ruido 3D
33
* @frame 710,400 (optional)
4-
* @description Using 3D noise to create simple animated texture.
4+
* @description Uso de ruido 3D para crear una simple textura animada.
55
*/
66
let noiseVal;
7-
//Increment x by 0.01
7+
//Incrementar x en 0,01
88
let x_increment = 0.01;
9-
//Increment z by 0.02 every draw() cycle
9+
//Incrementar z en 0.02 cada ciclo de draw()
1010
let z_increment = 0.02;
1111

12-
//Offset values
12+
//Valores de desviación
1313
let z_off, y_off, x_off;
1414

1515
function setup() {
16-
//Create the Canvas
16+
//Crear el Lienzo
1717
createCanvas(640, 360);
18-
//Define frame rate
18+
//Definir la velocidad de cuadro
1919
frameRate(20);
20-
//Initial value of z_off
20+
//Valor inicial de z_off
2121
z_off = 0;
2222
}
2323

2424
function draw() {
2525
x_off = 0;
2626
y_off = 0;
27-
//Make the background black
27+
//Hacer que el fondo sea negro
2828
background(0);
29-
//Adjust the noice detail
29+
//Ajustar el detalle del ruido
3030
noiseDetail(8, 0.65);
3131

32-
//For each x,y calculate noice value
32+
//Para cada x,y calcular el valor del ruido
3333
for (let y = 0; y < height; y++) {
3434
x_off += x_increment;
3535
y_off = 0;
3636

3737
for (let x = 0; x < width; x++) {
38-
//Calculate and Draw each pixel
38+
//Calcular y dibujar cada píxel
3939
noiseVal = noise(x_off, y_off, z_off);
4040
stroke(noiseVal * 255);
4141
y_off += x_increment;
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
/*
2-
* @name Random Chords
3-
* @description Accumulates random chords of a circle. Each chord in translucent
4-
* so they accumulate to give the illusion of a shaded sphere.
5-
* Contributed by Aatish Bhatia, inspired by <a href ="http://inconvergent.net/">Anders Hoff</a>
2+
* @name Cuerdas Aleatorias
3+
* @description Acumula cuerdas al azar de un círculo. Cada cuerda es translúcida,
4+
* de modo que se acumulan para dar la ilusión de una esfera sombreada.
5+
* Contribución de Aatish Bhatia, inspirado en <a href ="http://inconvergent.net/">Anders Hoff</a>
66
*/
77
function setup() {
88
createCanvas(400, 400);
99
background(255, 255, 255);
1010

11-
// translucent stroke using alpha value
11+
// trazo translúcido usando el valor alfa
1212
stroke(0, 0, 0, 15);
1313
}
1414

1515
function draw() {
16-
// draw two random chords each frame
16+
// trazar dos cuerdas al azar en cada cuadro
1717
randomChord();
1818
randomChord();
1919
}
2020

2121
function randomChord() {
22-
// find a random point on a circle
22+
// encontrar un punto aleatorio en un círculo
2323
let angle1 = random(0, 2 * PI);
2424
let xpos1 = 200 + 200 * cos(angle1);
2525
let ypos1 = 200 + 200 * sin(angle1);
2626

27-
// find another random point on the circle
27+
// encontrar otro punto aleatorio en el círculo
2828
let angle2 = random(0, 2 * PI);
2929
let xpos2 = 200 + 200 * cos(angle2);
3030
let ypos2 = 200 + 200 * sin(angle2);
3131

32-
// draw a line between them
32+
// trazar una línea entre ellos
3333
line(xpos1, ypos1, xpos2, ypos2);
3434
}

src/data/examples/es/08_Math/18_Map.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
2-
* @name Map
3-
* @description Use the map() function to take any number and scale it to a
4-
* new number that is more useful for the project that you are working on.
5-
* For example, use the numbers from the mouse position to control the size or color of a shape.
6-
* In this example, the mouse’s x-coordinate (numbers between 0 and 360) are scaled to new numbers
7-
* to define the color and size of a circle.
2+
* @name Mapear
3+
* @description Utiliza la función map() para tomar cualquier número y escalarlo a un
4+
* nuevo número que sea más útil para el proyecto en el que estés trabajando.
5+
* Por ejemplo, usa los números de la posición del ratón para controlar el tamaño o el color de una figura.
6+
* En este ejemplo, la coordenada x del ratón (números entre 0 y 360) se escalan a nuevos números
7+
* para definir el color y el tamaño de un círculo.
88
*/
99
function setup() {
1010
createCanvas(640, 400);
@@ -13,9 +13,9 @@ function setup() {
1313

1414
function draw() {
1515
background(0);
16-
// Scale the mouseX value from 0 to 640 to a range between 0 and 175
16+
// Escala el valor de mouseX de 0 a 640 a un rango entre 0 y 175
1717
let c = map(mouseX, 0, width, 0, 175);
18-
// Scale the mouseX value from 0 to 640 to a range between 40 and 300
18+
// Escala el valor de mouseX de 0 a 640 a un rango entre 40 y 300
1919
let d = map(mouseX, 0, width, 40, 300);
2020
fill(255, c, 0);
2121
ellipse(width/2, height/2, d, d);
Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11
/*
2-
* @name Parametric Equations
3-
* @description A parametric equation is where x and y
4-
* coordinates are both written in terms of another letter. This is
5-
* called a parameter and is usually given in the letter t or θ.
6-
* The inspiration was taken from the YouTube channel of Alexander Miller.
2+
* @name Ecuaciones Paramétricas
3+
* @description Una ecuación paramétrica es una en la cual las coordenadas x e y
4+
* están escritas en términos de otra variable.
5+
* Esto se llama un parámetro y se suele dar en la letra t o θ.
6+
* La inspiración se tomó del canal de YouTube de Alexander Miller.
77
*/
88

99
function setup(){
1010
createCanvas(720,400);
1111
}
1212

13-
// the parameter at which x and y depends is usually taken as either t or symbol of theta
13+
// el parámetro del que dependen x e y
14+
// se suele designar con la letra t o el símbolo de theta
1415
let t = 0;
1516
function draw(){
1617
background('#fff');
1718
translate(width/2,height/2);
1819
stroke('#0f0f0f');
1920
strokeWeight(1.5);
20-
//loop for adding 100 lines
21+
//bucle para añadir 100 líneas
2122
for(let i = 0;i<100;i++){
2223
line(x1(t+i),y1(t+i),x2(t+i)+20,y2(t+i)+20);
2324
}
2425
t+=0.15;
2526
}
26-
// function to change initial x co-ordinate of the line
27+
// función para cambiar la coordenada inicial x de la línea
2728
function x1(t){
2829
return sin(t/10)*125+sin(t/20)*125+sin(t/30)*125;
2930
}
3031

31-
// function to change initial y co-ordinate of the line
32+
// función para cambiar la coordenada y inicial de la línea
3233
function y1(t){
3334
return cos(t/10)*125+cos(t/20)*125+cos(t/30)*125;
3435
}
3536

36-
// function to change final x co-ordinate of the line
37+
// función para cambiar la coordenada x final de la línea
3738
function x2(t){
3839
return sin(t/15)*125+sin(t/25)*125+sin(t/35)*125;
3940
}
4041

41-
// function to change final y co-ordinate of the line
42+
// función para cambiar la coordenada final de la línea
4243
function y2(t){
4344
return cos(t/15)*125+cos(t/25)*125+cos(t/35)*125;
44-
}
45+
}

src/data/examples/es/09_Simulate/09_Springs.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
2-
* @name Springs
2+
* @name Resortes
33
* @frame 710,400
4-
* @description Move the mouse over one of the circles and click to re-position.
5-
* When you release the mouse, it will snap back into position.
6-
* Each circle has a slightly different behavior.
7-
* (ported from https://processing.org/examples/springs.html)
4+
* @description Mueve el ratón sobre uno de los círculos y haz clic para reposicionarlo.
5+
* Cuando sueltes el ratón, se volverá a colocar en su posición.
6+
* Cada círculo tiene un comportamiento ligeramente diferente.
7+
* (puerto de https://processing.org/examples/springs.html)
88
*/
99
let num = 3;
1010
let springs = [];
@@ -144,4 +144,4 @@ function Spring (_x, _y, _s, _d, _m, _k_in, _others, _id) {
144144
this.rest_posx = this.y_pos;
145145
this.rest_posy = this.y_pos;
146146
}
147-
};
147+
};

0 commit comments

Comments
 (0)