Skip to content

Commit

Permalink
math fix
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacbowen committed Feb 24, 2024
1 parent 87ae92d commit 51c4ea2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SphereWithRods {
sparklineCanvas: HTMLCanvasElement;
sparklineContext: CanvasRenderingContext2D;
startTime: number;
totalDuration: number = 60; // seconds
totalDuration: number = 5; // seconds

constructor() {
this.constructSphere();
Expand Down Expand Up @@ -63,7 +63,7 @@ class SphereWithRods {
this.sparklineContext.beginPath();

// placing this slightly inside the canvas, to ensure that the line is not cut off
for (let x = 10; x <= this.sparklineCanvas.width - 20; x++) {
for (let x = 10; x <= this.sparklineCanvas.width - 10; x++) {
const t = x / this.sparklineCanvas.width;
const y = this.calculateFrequency(t) * (this.sparklineCanvas.height - 20) + 10;
this.sparklineContext.lineTo(x, this.sparklineCanvas.height - y);
Expand Down

0 comments on commit 51c4ea2

Please sign in to comment.