Skip to content

Commit 0e6ba4e

Browse files
authored
Turn "const" into "let" in example code (#250)
The p5 reference does not currently introduce "const", and the containing example codes don't make use of it either (as far as I could tell). This is converting all our example code to "let".
1 parent 7fd5bb9 commit 0e6ba4e

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

examples/faceMesh-uv-map/sketch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ function draw() {
5454
let a = face.keypoints[indexA];
5555
let b = face.keypoints[indexB];
5656
let c = face.keypoints[indexC];
57-
const uvA = { x: uvCoords[indexA][0], y: uvCoords[indexA][1] };
58-
const uvB = { x: uvCoords[indexB][0], y: uvCoords[indexB][1] };
59-
const uvC = { x: uvCoords[indexC][0], y: uvCoords[indexC][1] };
57+
let uvA = { x: uvCoords[indexA][0], y: uvCoords[indexA][1] };
58+
let uvB = { x: uvCoords[indexB][0], y: uvCoords[indexB][1] };
59+
let uvC = { x: uvCoords[indexC][0], y: uvCoords[indexC][1] };
6060
vertex(a.x, a.y, uvA.x, uvA.y);
6161
vertex(b.x, b.y, uvB.x, uvB.y);
6262
vertex(c.x, c.y, uvC.x, uvC.y);

examples/neuralNetwork-color-classifier/sketch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function setup() {
5858
classifier.normalizeData();
5959

6060
// Step 6: train your neural network
61-
const trainingOptions = {
61+
let trainingOptions = {
6262
epochs: 32,
6363
batchSize: 12,
6464
};
@@ -71,7 +71,7 @@ function finishedTraining() {
7171

7272
// Step 8: make a classification
7373
function classify() {
74-
const input = [r, g, b];
74+
let input = [r, g, b];
7575
classifier.classify(input, handleResults);
7676
}
7777

examples/neuralNetwork-load-model/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function setup() {
3636
};
3737
classifier = ml5.neuralNetwork(classifierOptions);
3838

39-
const modelDetails = {
39+
let modelDetails = {
4040
model: "model/model.json",
4141
metadata: "model/model_meta.json",
4242
weights: "model/model.weights.bin",

examples/neuroEvolution-sensors/creature.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Creature {
6969
}
7070

7171
// Predicting the force to apply
72-
const outputs = this.brain.predictSync(inputs);
72+
let outputs = this.brain.predictSync(inputs);
7373
let angle = outputs[0].value * TWO_PI;
7474
let magnitude = outputs[1].value;
7575
let force = p5.Vector.fromAngle(angle).setMag(magnitude);

examples/soundClassifier-teachable-machine/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let classifier;
1414
let predictedSound = "";
1515

1616
// Link to custom Teachable Machine model
17-
const modelJson = "https://teachablemachine.withgoogle.com/models/FvsFiSwHW/";
17+
let modelJson = "https://teachablemachine.withgoogle.com/models/FvsFiSwHW/";
1818

1919
function preload() {
2020
// Load Teachable Machine model

0 commit comments

Comments
 (0)