Skip to content

Commit

Permalink
chore: add reference url of drawBezierSplit function
Browse files Browse the repository at this point in the history
  • Loading branch information
soonlive committed Sep 5, 2016
1 parent fb0ce08 commit 517aedb
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions js/components/common/CurveBall.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default class CurveBall extends React.Component {
this.animationQueue.every((animation)=> !animation || animation.progress >= 1);

drawBezierSplit = (ball, x0, y0, x1, y1, x2, y2, t0, t1)=> {
// reference http://www.pjgalbraith.com/drawing-animated-curves-javascript/
if (t0 === 0.0 && t1 === 1.0) {
ball.draw(x2, y2);
} else if (t0 !== t1) {
Expand All @@ -58,9 +59,6 @@ export default class CurveBall extends React.Component {
let t02 = t01 * t01;
let t03 = 2.0 * t0 * t01;

// let nx0 = t02 * x0 + t03 * x1 + t00 * x2;
// let ny0 = t02 * y0 + t03 * y1 + t00 * y2;

t00 = t1 * t1;
t01 = 1.0 - t1;
t02 = t01 * t01;
Expand All @@ -69,9 +67,6 @@ export default class CurveBall extends React.Component {
const nx2 = t02 * x0 + t03 * x1 + t00 * x2;
const ny2 = t02 * y0 + t03 * y1 + t00 * y2;

// let nx1 = lerp(lerp(x0, x1, t0), lerp(x1, x2, t0), t1);
// let ny1 = lerp(lerp(y0, y1, t0), lerp(y1, y2, t0), t1);

ball.draw(nx2, ny2);
}
};
Expand Down

0 comments on commit 517aedb

Please sign in to comment.