Pinned Loading
-
Cubic Bézier Javascript. Matches App...
Cubic Bézier Javascript. Matches Apple WebKit/UnitBezier.h 1/** MIT License github.com/pushkine/ */
2function cubicBezier(x1: number, y1: number, x2: number, y2: number) {
3if (!(x1 >= 0 && x1 <= 1 && x2 >= 0 && x2 <= 1))
4throw new Error(`CubicBezier x1 & x2 values must be { 0 < x < 1 }, got { x1 : ${x1}, x2: ${x2} }`);
5const ax = 1.0 - (x2 = 3.0 * (x2 - x1) - (x1 *= 3.0)) - x1,
-
Javascript spring solving algorithm....
Javascript spring solving algorithm. Solves real life damped harmonic oscillator physics equations as used in Apple iOS & many others. Tweak damping and stiffness for spring behavior, scale mass with value delta and set soft to force solution for a critically damped spring ( no bounce eased smooth ) . Play with this function's graph on www.desmos.com/calculator/urztjwk4dv 1/** MIT License github.com/pushkine/ */
2interface SpringParams {
3mass?: number; // = 1.0
4damping?: number; // = 10.0
5stiffness?: number; // = 100.0
-
Javascript color conversion algorith...
Javascript color conversion algorithms. Complete HEX, HSL, RGB and named css color parsing & interpolation in the HCL color space. All constants directly sourced from the google/chromium open source project. Play, compare and benchmark against d3 on https://svelte.dev/repl/0a40a8348f8841d0b7007c58e4d9b54c 1type RGBA = [number, number, number, number];
2const rgb255 = (v: number) => (v < 255 ? (v > 0 ? v : 0) : 255);
3const b1 = (v: number) => (v > 0.0031308 ? v ** (1 / 2.4) * 269.025 - 14.025 : v * 3294.6);
4const b2 = (v: number) => (v > 0.2068965 ? v ** 3 : (v - 4 / 29) * (108 / 841));
5const a1 = (v: number) => (v > 10.314724 ? ((v + 14.025) / 269.025) ** 2.4 : v / 3294.6);
-
Styles and colors for CLIs in TypeSc...
Styles and colors for CLIs in TypeScript. Try it on https://replit.com/@pushkine/ColdTautSpools#index.ts 1/** MIT License github.com/pushkine */
2export const color = (function <C extends readonly any[], M extends {}>(colors: C, mods: M) {
3const fn = (c1: number, c2: number, str: string) => `\x1b[${c1}m${str}\x1b[${c2}m`;
4const fnc = (c1: number, str: string) => fn(c1, 39, str.replace(/\x1b\[39m/g, `\x1b[${c1}m`));
5const obj = { unstyle: (str: string) => str.replace(/\x1b\[[0-9]{1,2}m/g, ""), grey: fnc.bind(null, 90) };
-
benchmarks.md
benchmarks.md 1https://jsbench.me/user/pushkine
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.