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
import { app, h } from "hyperapp"; | |
import { Stateful } from './helpers' | |
/* Working example, https://codepen.io/sergey-shpak/pen/maMopd */ | |
// --- STATEFUL COMPONENT --- | |
// Don't use arrow functions for stateful components/actions | |
// Since context is linked to it's definition context |
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
/** | |
* Check if 2 circles collide | |
* | |
* Takes velocities and alters them as if the coordinate system they're on was rotated | |
* | |
* @param Number | p1x | x coordinate of the first particle | |
* @param Number | p1y | y coordinate of the first particle | |
* @param Number | r1 | radius of the first particle | |
* @param Number | p2x | x coordinate of the second particle | |
* @param Number | p2y | y coordinate of the second particle |