File tree Expand file tree Collapse file tree 3 files changed +22
-13
lines changed Expand file tree Collapse file tree 3 files changed +22
-13
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,15 @@ let dancingWords = [];
11
11
class DanceSpan {
12
12
constructor ( element , x , y ) {
13
13
element . position ( x , y ) ;
14
+ this . element = element ;
15
+ this . x = x ;
16
+ this . y = y ;
14
17
}
15
18
16
19
brownian ( ) {
17
- x += random ( - 6 , 6 ) ;
18
- y += random ( - 6 , 6 ) ;
19
- element . position ( x , y ) ;
20
+ this . x += random ( - 6 , 6 ) ;
21
+ this . y += random ( - 6 , 6 ) ;
22
+ this . element . position ( this . x , this . y ) ;
20
23
}
21
24
}
22
25
@@ -28,7 +31,7 @@ function setup() {
28
31
createP (
29
32
'I learn in this Letter, that Don Peter of Aragon, ' +
30
33
' comes this night to Messina'
31
- ) . addClass ( 'text' ) ;
34
+ ) . addClass ( 'text' ) . hide ( ) ;
32
35
33
36
// This line grabs the paragraph just created, but it would
34
37
// also grab any other elements with class 'text' in the HTML
Original file line number Diff line number Diff line change @@ -11,12 +11,15 @@ let dancingWords = [];
11
11
class DanceSpan {
12
12
constructor ( element , x , y ) {
13
13
element . position ( x , y ) ;
14
+ this . element = element ;
15
+ this . x = x ;
16
+ this . y = y ;
14
17
}
15
18
16
19
brownian ( ) {
17
- x += random ( - 6 , 6 ) ;
18
- y += random ( - 6 , 6 ) ;
19
- element . position ( x , y ) ;
20
+ this . x += random ( - 6 , 6 ) ;
21
+ this . y += random ( - 6 , 6 ) ;
22
+ this . element . position ( this . x , this . y ) ;
20
23
}
21
24
}
22
25
@@ -25,9 +28,9 @@ function setup() {
25
28
// Es para diferenciar entre la creación de un elemento y su selección.
26
29
// Los elementos seleccionados no necesitan ser creados por p5js, pueden ser HTML plano.
27
30
createP (
28
- 'I learne in this Letter, that Don Peter of Arragon, ' +
31
+ 'I learn in this Letter, that Don Peter of Arragon, ' +
29
32
' comes this night to Messina'
30
- ) . addClass ( 'text' ) ;
33
+ ) . addClass ( 'text' ) . hide ( ) ;
31
34
32
35
// Esta línea toma el párrafo recién creado, pero podría también
33
36
// tomar otros elementos de la clase 'text' en la página HTML.
Original file line number Diff line number Diff line change @@ -11,12 +11,15 @@ let dancingWords = [];
11
11
class DanceSpan {
12
12
constructor ( element , x , y ) {
13
13
element . position ( x , y ) ;
14
+ this . element = element ;
15
+ this . x = x ;
16
+ this . y = y ;
14
17
}
15
18
16
19
brownian ( ) {
17
- x += random ( - 6 , 6 ) ;
18
- y += random ( - 6 , 6 ) ;
19
- element . position ( x , y ) ;
20
+ this . x += random ( - 6 , 6 ) ;
21
+ this . y += random ( - 6 , 6 ) ;
22
+ this . element . position ( this . x , this . y ) ;
20
23
}
21
24
}
22
25
@@ -28,7 +31,7 @@ function setup() {
28
31
createP (
29
32
'I learn in this Letter, that Don Peter of Aragon, ' +
30
33
' comes this night to Messina'
31
- ) . addClass ( 'text' ) ;
34
+ ) . addClass ( 'text' ) . hide ( ) ;
32
35
33
36
// This line grabs the paragraph just created, but it would
34
37
// also grab any other elements with class 'text' in the HTML
You can’t perform that action at this time.
0 commit comments