Skip to content

Commit 10b3760

Browse files
committed
Translation of missing example translations in Objects and Motion
1 parent 2eba7e7 commit 10b3760

File tree

8 files changed

+93
-93
lines changed

8 files changed

+93
-93
lines changed

src/data/examples/es/11_Objects/04_Inheritance.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/* @name Inheritance
2-
* @description A class can be defined using another class as a
3-
* foundation. In object-oriented programming terminology, one class can
4-
* inherit fields and methods from another. An object that inherits from
5-
* another is called a subclass, and the object it inherits from is called
6-
* a superclass. A subclass extends the superclass.
1+
/* @name Herencia
2+
* @description Una clase puede ser definida usando otra clase como base.
3+
* En la terminología de la programación orientada a objetos, una clase
4+
* puede heredar campos y métodos de otra. Un objeto que hereda
5+
* de otro se llama subclase, y el objeto del que hereda se
6+
* llama superclase. Una subclase extiende la superclase.
77
*/
88
let spots, arm;
99

src/data/examples/es/11_Objects/05_Composite_Objects.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* @name Composite Objects
2-
* @description An object can include several other objects.
3-
* Creating such composite objects is a good way to use the principles
4-
* of modularity and build higher levels of abstraction within a program.
1+
/* @name Objetos Compuestos
2+
* @description Un objeto puede incluir varios otros objetos.
3+
* La creación de tales objetos compuestos es una buena manera de usar los principios
4+
* de modularidad y construir niveles más altos de abstracción dentro de un programa.
55
*/
66
let er1, er2;
77

src/data/examples/es/13_Motion/01_non_orthogonal_reflection.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*
2-
* @name Non Orthogonal Reflection
2+
* @name Reflejo no ortogonal
33
* @frame 710,400 (optional)
4-
* @description This is a port by David Blitz of the "Reflection 1" example from processing.org/examples
4+
* @description Este es un puerto de David Blitz del ejemplo "Reflection 1" en processing.org/examples
55
*/
66

7-
//Position of left hand side of floor
7+
//Posición del lado izquierdo del suelo
88
let base1;
99

10-
//Position of right hand side of floor
10+
//Posición del lado derecho del suelo
1111
let base2;
12-
//Length of floor
12+
//La longitud del suelo
1313
//let baseLength;
1414

15-
// Variables related to moving ball
15+
// Variables relacionadas con el movimiento de la bola
1616
let position;
1717
let velocity;
1818
let r = 6;
@@ -26,57 +26,57 @@ function setup() {
2626
base2 = createVector(width, height);
2727
//createGround();
2828

29-
//start ellipse at middle top of screen
29+
//Empezar la elipse en el centro de la parte superior de la pantalla
3030
position = createVector(width / 2, 0);
3131

32-
//calculate initial random velocity
32+
//Calcular la velocidad aleatoria inicial
3333
velocity = p5.Vector.random2D();
3434
velocity.mult(speed);
3535
}
3636

3737
function draw() {
38-
//draw background
38+
//dibujar el fondo
3939
fill(0, 12);
4040
noStroke();
4141
rect(0, 0, width, height);
4242

43-
//draw base
43+
//dibujar la base
4444
fill(200);
4545
quad(base1.x, base1.y, base2.x, base2.y, base2.x, height, 0, height);
4646

47-
//calculate base top normal
47+
//calcular la normal a la base superior
4848
let baseDelta = p5.Vector.sub(base2, base1);
4949
baseDelta.normalize();
5050
let normal = createVector(-baseDelta.y, baseDelta.x);
5151
let intercept = p5.Vector.dot(base1, normal);
5252

53-
//draw ellipse
53+
//dibujar elipse
5454
noStroke();
5555
fill(255);
5656
ellipse(position.x, position.y, r * 2, r * 2);
5757

58-
//move ellipse
58+
//mover elipse
5959
position.add(velocity);
6060

61-
//normalized incidence vector
61+
//vector de incidencia normalizado
6262
incidence = p5.Vector.mult(velocity, -1);
6363
incidence.normalize();
6464

65-
// detect and handle collision with base
65+
// detectar y gestionar la colisión con la base
6666
if (p5.Vector.dot(normal, position) > intercept) {
67-
//calculate dot product of incident vector and base top
67+
//calcular el producto escalar del vector incidente y la parte superior de la base
6868
let dot = incidence.dot(normal);
6969

70-
//calculate reflection vector
71-
//assign reflection vector to direction vector
70+
//calcular el vector del reflejo
71+
//asignar el vector de reflejo al vector de dirección
7272
velocity.set(
7373
2 * normal.x * dot - incidence.x,
7474
2 * normal.y * dot - incidence.y,
7575
0
7676
);
7777
velocity.mult(speed);
7878

79-
// draw base top normal at collision point
79+
// dibujar la base superior normal en el punto de colisión
8080
stroke(255, 128, 0);
8181
line(
8282
position.x,
@@ -87,23 +87,23 @@ function draw() {
8787
}
8888
//}
8989

90-
// detect boundary collision
91-
// right
90+
// detectar la colisión límite
91+
// derecha
9292
if (position.x > width - r) {
9393
position.x = width - r;
9494
velocity.x *= -1;
9595
}
96-
// left
96+
// izquierda
9797
if (position.x < r) {
9898
position.x = r;
9999
velocity.x *= -1;
100100
}
101-
// top
101+
// arriba
102102
if (position.y < r) {
103103
position.y = r;
104104
velocity.y *= -1;
105105

106-
//randomize base top
106+
//aleatorizar la parte superior de la base
107107
base1.y = random(height - 100, height);
108108
base2.y = random(height - 100, height);
109109
}

src/data/examples/es/13_Motion/02_Linear_Motion.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
2-
* @name Linear
2+
* @name Lineal
33
* @frame 720,400
4-
* @description Changing a variable to create a moving line.
5-
* When the line moves off the edge of the window,
6-
* the variable is set to 0, which places the line back at the bottom of the screen.
4+
* @description Cambiar una variable para crear una línea en movimiento.
5+
* Cuando la línea se mueve fuera del borde de la ventana,
6+
* la variable se pone a 0, lo que coloca la línea de nuevo en la parte inferior de la pantalla.
77
*/
88

99
let a;
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
/*
2-
* @name Bounce
2+
* @name Rebote
33
* @frame 720,400
4-
* @description When the shape hits the edge of the window, it reverses its direction.
4+
* @description Cuando la forma golpea el borde de la ventana, invierte su dirección.
55
*/
66

7-
let rad = 60; // Width of the shape
8-
let xpos, ypos; // Starting position of shape
7+
let rad = 60; // El ancho de la forma
8+
let xpos, ypos; // Posición inicial de la forma
99

10-
let xspeed = 2.8; // Speed of the shape
11-
let yspeed = 2.2; // Speed of the shape
10+
let xspeed = 2.8; // La velocidad de la forma
11+
let yspeed = 2.2; // La velocidad de la forma
1212

13-
let xdirection = 1; // Left or Right
14-
let ydirection = 1; // Top to Bottom
13+
let xdirection = 1; // Izquierda o derecha
14+
let ydirection = 1; // De arriba a abajo
1515

1616
function setup() {
1717
createCanvas(720, 400);
1818
noStroke();
1919
frameRate(30);
2020
ellipseMode(RADIUS);
21-
// Set the starting position of the shape
21+
// Establecer la posición de partida de la forma
2222
xpos = width / 2;
2323
ypos = height / 2;
2424
}
2525

2626
function draw() {
2727
background(102);
2828

29-
// Update the position of the shape
29+
// Actualizar la posición de la forma
3030
xpos = xpos + xspeed * xdirection;
3131
ypos = ypos + yspeed * ydirection;
3232

33-
// Test to see if the shape exceeds the boundaries of the screen
34-
// If it does, reverse its direction by multiplying by -1
33+
// Prueba para ver si la forma excede los límites de la pantalla
34+
// Si lo hace, invierta su dirección multiplicando por -1
3535
if (xpos > width - rad || xpos < rad) {
3636
xdirection *= -1;
3737
}
3838
if (ypos > height - rad || ypos < rad) {
3939
ydirection *= -1;
4040
}
4141

42-
// Draw the shape
42+
// Dibuja la forma
4343
ellipse(xpos, ypos, rad, rad);
4444
}

src/data/examples/es/13_Motion/04_Bouncy_Bubbles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* @name Bouncy Bubbles
2+
* @name Burbujas Saltarinas
33
* @frame 720,400
4-
* @description based on code from Keith Peters. Multiple-object collision..
4+
* @description basado en el código de Keith Peters. Colisión de múltiples objetos...
55
*/
66

77
let numBalls = 13;

src/data/examples/es/13_Motion/05_Morph.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
/*
2-
* @name Morph
2+
* @name Transformar
33
* @frame 720,400
4-
* @description Changing one shape into another by interpolating vertices from one to another.
4+
* @description Cambiar una forma por otra interpolando vértices de uno a otro.
55
*/
66

7-
// Two ArrayLists to store the vertices for two shapes
8-
// This example assumes that each shape will have the same
9-
// number of vertices, i.e. the size of each ArrayList will be the same
7+
// Dos ArrayList para almacenar los vértices de dos geometrias
8+
// Este ejemplo asume que cada forma tendrá el mismo número de vértices
9+
// es decir, el tamaño de cada ArrayList será el mismo
1010
let circle = [];
1111
let square = [];
1212

13-
// An ArrayList for a third set of vertices, the ones we will be drawing
14-
// in the window
13+
// Un ArrayList para un tercer conjunto de vértices, los que dibujaremos
14+
// en la ventana
1515
let morph = [];
1616

17-
// This boolean variable will control if we are morphing to a circle or square
17+
// Esta variable booleana controlará si estamos transformando en un círculo o un cuadrado
1818
let state = false;
1919

2020
function setup() {
2121
createCanvas(720, 400);
2222

23-
// Create a circle using vectors pointing from center
23+
// Crear un círculo usando vectores que apunten desde el centro
2424
for (let angle = 0; angle < 360; angle += 9) {
25-
// Note we are not starting from 0 in order to match the
26-
// path of a circle.
25+
// Ten en cuenta que no estamos empezando desde 0 para que coincida con
26+
// la trayectoria de un círculo.
2727
let v = p5.Vector.fromAngle(radians(angle - 135));
2828
v.mult(100);
2929
circle.push(v);
30-
// Let's fill out morph ArrayList with blank PVectors while we are at it
30+
// Llenemos el ArrayList de transformación con PVectores en blanco mientras estamos en ello.
3131
morph.push(createVector());
3232
}
3333

34-
// A square is a bunch of vertices along straight lines
35-
// Top of square
34+
// Un cuadrado es un montón de vértices a lo largo de líneas rectas
35+
// La parte superior del cuadrado
3636
for (let x = -50; x < 50; x += 10) {
3737
square.push(createVector(x, -50));
3838
}
39-
// Right side
39+
// Lado derecho
4040
for (let y = -50; y < 50; y += 10) {
4141
square.push(createVector(50, y));
4242
}
43-
// Bottom
43+
// Parte inferior
4444
for (let x = 50; x > -50; x -= 10) {
4545
square.push(createVector(x, 50));
4646
}
47-
// Left side
47+
// Lado izquierdo
4848
for (let y = 50; y > -50; y -= 10) {
4949
square.push(createVector(-50, y));
5050
}
@@ -53,35 +53,35 @@ function setup() {
5353
function draw() {
5454
background(51);
5555

56-
// We will keep how far the vertices are from their target
56+
// Guardaremos la distancia de los vértices de su objetivo
5757
let totalDistance = 0;
5858

59-
// Look at each vertex
59+
// Mira cada vértice
6060
for (let i = 0; i < circle.length; i++) {
6161
let v1;
62-
// Are we lerping to the circle or square?
62+
// ¿Estamos yendo hacia el círculo o hacia el cuadrado?
6363
if (state) {
6464
v1 = circle[i];
6565
} else {
6666
v1 = square[i];
6767
}
68-
// Get the vertex we will draw
68+
// Consigue el vértice que dibujaremos
6969
let v2 = morph[i];
70-
// Lerp to the target
70+
// Transiciona hacia el objetivo...
7171
v2.lerp(v1, 0.1);
72-
// Check how far we are from target
72+
// Comprueba lo lejos que estamos del objetivo
7373
totalDistance += p5.Vector.dist(v1, v2);
7474
}
7575

76-
// If all the vertices are close, switch shape
76+
// Si todos los vértices están cerca, cambia de forma
7777
if (totalDistance < 0.1) {
7878
state = !state;
7979
}
8080

81-
// Draw relative to center
81+
// Dibuja relativo al centro
8282
translate(width / 2, height / 2);
8383
strokeWeight(4);
84-
// Draw a polygon that makes up all the vertices
84+
// Dibuja un polígono compuesto de todos los vértices
8585
beginShape();
8686
noFill();
8787
stroke(255);

src/data/examples/es/13_Motion/06_Moving_On_Curves.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
2-
* @name Moving On Curves
2+
* @name Moviéndose por Curvas
33
* @frame 720,400
4-
* @description In this example, the circles moves along the curve y = x^4.
5-
* Click the mouse to have it move to a new position.
4+
* @description En este ejemplo, los círculos se mueven a lo largo de la curva y = x^4.
5+
* Haz clic con el ratón para que se mueva a una nueva posición.
66
*/
77

8-
let beginX = 20.0; // Initial x-coordinate
9-
let beginY = 10.0; // Initial y-coordinate
10-
let endX = 570.0; // Final x-coordinate
11-
let endY = 320.0; // Final y-coordinate
12-
let distX; // X-axis distance to move
13-
let distY; // Y-axis distance to move
14-
let exponent = 4; // Determines the curve
15-
let x = 0.0; // Current x-coordinate
16-
let y = 0.0; // Current y-coordinate
17-
let step = 0.01; // Size of each step along the path
18-
let pct = 0.0; // Percentage traveled (0.0 to 1.0)
8+
let beginX = 20.0; // Coordenada X inicial
9+
let beginY = 10.0; // Coordenada Y inicial
10+
let endX = 570.0; // Coordenada X final
11+
let endY = 320.0; // Coordenada Y final
12+
let distX; // Distancia que moverse en el eje X
13+
let distY; // Distancia que moverse en el eje Y
14+
let exponent = 4; // Determina la curva
15+
let x = 0.0; // Coordenada X actual
16+
let y = 0.0; // Coordenada Y actual
17+
let step = 0.01; // Tamaño de cada paso a lo largo del camino
18+
let pct = 0.0; // Porcentaje viajado (0.0 a 1.0)
1919

2020
function setup() {
2121
createCanvas(720, 400);

0 commit comments

Comments
 (0)