Created
July 3, 2018 03:51
-
-
Save amccloud/844be0c7c033eb92d12377b1901a6173 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const polarToCartesian = ({ angle, radius }) => ({ | |
x: radius * Math.cos(angle), | |
y: radius * Math.sin(angle) | |
}); | |
const ball = document.querySelector('#b .ball'); | |
const ballStyler = styler(ball); | |
let pointerTracker; | |
physics({ | |
from: { angle: 0, radius: 3 }, | |
velocity: { angle: 5, radius: 0 } | |
}).pipe(polarToCartesian) | |
.start(ballStyler.set); | |
const startTracking = () => { | |
pointerTracker = pointer({ | |
x: ballStyler.get('x'), | |
y: ballStyler.get('y') | |
}).start(ballStyler.set); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment