Skip to content

Instantly share code, notes, and snippets.

@lachrymaLF
lachrymaLF / lkrm.ts
Created July 24, 2022 18:58
short helpers
// DEBUG
const _$ = console.log.bind(console);
// LKRM_STD
const $ = <T extends HTMLElement = HTMLElement>(selector: string) => document.querySelector<T>(selector);
const $$ = <T extends HTMLElement = HTMLElement>(selector: string) => document.querySelectorAll<T>(selector);
const lerp =(x: number, a: number, b: number): number => a + x * (b - a);
const { sqrt, log: ln, pow, min, max, sin, cos, tan, asin, acos, atan, atan2, PI, E } = Math;
const to_radians = (x: number) => x / 180 * PI;