Skip to content

Commit

Permalink
Update sketch.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jcponce committed Jul 16, 2023
1 parent 502ae4d commit e7166c6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions math1052/sketches/chapter-01/damped-oscillator/sketch.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* @name Spring
* @frame 710, 400
* @description Click, drag, and release the horizontal bar to start the spring.
*/
@name Spring
@frame 710, 400
@description Click, drag, and release the horizontal bar to start the spring.
*/
// Spring drawing constants for top bar
let springHeight = 32,
left,
Expand All @@ -21,7 +21,7 @@ let M = 10.8, // Mass
D = 0.99, // Damping
R = 200; // Rest position

// Spring simulation variables
// Spring simulation letiables
let ps = R, // Position
vs = 0.0, // Velocity
as = 0, // Acceleration
Expand All @@ -34,7 +34,7 @@ function setup() {
left = width / 2 + 100;
right = width / 2 - 100;

for (var i=0; i<maxPoints; i++) {
for (let i=0; i<maxPoints; i++) {
points[i] = ps;
}

Expand Down Expand Up @@ -116,7 +116,7 @@ function drawGraph() {
strokeWeight(2);
noFill();
beginShape();
for (var i=0; i<maxPoints; i++) {
for (let i=0; i<maxPoints; i++) {
vertex(i*3.7, points[i]);
}
endShape();
Expand Down

0 comments on commit e7166c6

Please sign in to comment.