Skip to content
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.

Commit

Permalink
Errata: Reverse sine/cosine in example to match book text. (no visual…
Browse files Browse the repository at this point in the history
… effect on demo)
  • Loading branch information
lamberta committed Jan 25, 2014
1 parent b813019 commit 73e9c03
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions errata.md
Expand Up @@ -37,6 +37,18 @@ abstraction (submitted by Peter Stema), and the book omits
the line where the angle is incremented each frame
(submitted by Steve Paget).

### p. 60, p. 61

In examples `08-circle.html` and `09-oval.html`, to match
the text above, the sine and cosine functions should be
reversed when calculating the ball's position. (Submitted by
Gerald Cullen)

~~~
ball.x = centerX + Math.cos(angle) * radius;
ball.y = centerY + Math.sin(angle) * radius;
~~~

### p. 67

Typo in the last sentence, it should read: *You should have
Expand Down
4 changes: 2 additions & 2 deletions examples/ch03/08-circle.html
Expand Up @@ -28,8 +28,8 @@
window.requestAnimationFrame(drawFrame, canvas);
context.clearRect(0, 0, canvas.width, canvas.height);

ball.x = centerX + Math.sin(angle) * radius;
ball.y = centerY + Math.cos(angle) * radius;
ball.x = centerX + Math.cos(angle) * radius;
ball.y = centerY + Math.sin(angle) * radius;
angle += speed;
ball.draw(context);
}());
Expand Down
4 changes: 2 additions & 2 deletions examples/ch03/09-oval.html
Expand Up @@ -29,8 +29,8 @@
window.requestAnimationFrame(drawFrame, canvas);
context.clearRect(0, 0, canvas.width, canvas.height);

ball.x = centerX + Math.sin(angle) * radiusX;
ball.y = centerY + Math.cos(angle) * radiusY;
ball.x = centerX + Math.cos(angle) * radiusX;
ball.y = centerY + Math.sin(angle) * radiusY;
angle += speed;
ball.draw(context);
}());
Expand Down

0 comments on commit 73e9c03

Please sign in to comment.