This file contains hidden or 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
// add any configs you like | |
export default { | |
value:0.5, | |
autoSave: false, | |
}; |
This file contains hidden or 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 { vec2 } from "gl-matrix"; | |
export const bezier = (mPoints, t) => { | |
if (mPoints.length === 2) { | |
const p = vec2.create(); | |
vec2.lerp(p, mPoints[0], mPoints[1], t); | |
return p; | |
} | |
const a = []; |
This file contains hidden or 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
// Triangle format: [[x, y], [x, y], [x, y]] | |
function doTrianglesIntersect(triangle1, triangle2) { | |
function doEdgesIntersect(edge1, edge2) { | |
// Check if two line segments (edges) intersect | |
const [x1, y1] = edge1[0]; | |
const [x2, y2] = edge1[1]; | |
const [x3, y3] = edge2[0]; | |
const [x4, y4] = edge2[1]; |
This file contains hidden or 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
// Create a canvas element | |
const canvas = document.createElement('canvas'); | |
const context = canvas.getContext('2d'); | |
canvas.width = 64; | |
canvas.height = 64; | |
// Function to calculate non-transparent pixels | |
function countNonTransparentPixels(character) { | |
// Clear the canvas | |
context.clearRect(0, 0, canvas.width, canvas.height); |
OlderNewer