Skip to content

Commit 2cc42a4

Browse files
committed
refactor
1 parent 65d0025 commit 2cc42a4

3 files changed

Lines changed: 48 additions & 27 deletions

File tree

.gitattributes

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

code.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
export function caricamentoRisorse() {}
2+
3+
//
4+
5+
export function impostazioni() {}
6+
7+
//
8+
9+
export function sfondo() {}
10+
11+
//
12+
13+
/**
14+
* Questa funzione si occupa di disegnare un punto della lettera.
15+
*
16+
* @typedef {Object} Ingredienti
17+
* @property {number} x - La coordinata x del punto
18+
* @property {number} y - La coordinata y del punto
19+
* @property {number} angolo - L'angolo della curva della font in quel punto
20+
* @property {number} indice - Il numero del punto nella sequenza
21+
* @property {number} unita - Unita' di misura di riferimento
22+
* @property {number} volume - Il volume del microfono
23+
*
24+
* @param {Ingredienti} ingredienti
25+
*/
26+
export function disegnaPunto({ x, y, angolo, indice, unita, volume }) {
27+
push();
28+
translate(x, y);
29+
30+
noFill();
31+
stroke(0);
32+
33+
rectMode(CENTER);
34+
fill("deeppink");
35+
noStroke();
36+
rotate(frameCount + indice);
37+
scale(1 + volume * 10);
38+
rect(0, 0, unita / 2);
39+
pop();
40+
}

sketch.js

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
import { AudioController } from "./modules/audioController.js";
2+
import {
3+
disegnaPunto,
4+
caricamentoRisorse,
5+
impostazioni,
6+
sfondo,
7+
} from "./code.js";
28

39
// /* Variabili */
410

@@ -15,7 +21,6 @@ let densita = 1;
1521

1622
// Device orientation variables
1723
let permissionGranted = false;
18-
let nonios13device = false;
1924
let f = 0;
2025

2126
/* Funzione */
@@ -24,36 +29,14 @@ const audioController = new AudioController();
2429

2530
let micLevel = 0;
2631

27-
function disegnaPunto({ x, y, angolo, indice, unita, volume }) {
28-
push();
29-
translate(x, y);
30-
31-
// if (indice % 2 == 0) {
32-
// fill(0);
33-
// } else {
34-
// fill(255);
35-
// }
36-
noFill();
37-
stroke(0);
38-
39-
rectMode(CENTER);
40-
fill("deeppink");
41-
noStroke();
42-
rotate(frameCount + indice);
43-
scale(1 + volume * 10);
44-
rect(0, 0, unita / 2);
45-
pop();
46-
47-
// image(graphics, x, y);
48-
}
49-
5032
/* Procedure (cose brutte) */
5133

5234
let font;
5335
let actualFontSize = 1;
5436

5537
function preload() {
5638
font = loadFont(percorsoFont);
39+
caricamentoRisorse();
5740
}
5841

5942
function setup() {
@@ -68,6 +51,7 @@ function setup() {
6851
angleMode(DEGREES);
6952

7053
setupStartButtonClick();
54+
impostazioni();
7155

7256
// Set default permission for non-iOS devices
7357
if (
@@ -77,7 +61,6 @@ function setup() {
7761
)
7862
) {
7963
permissionGranted = true;
80-
nonios13device = true;
8164
}
8265
}
8366

0 commit comments

Comments
 (0)