@trinketmage/sword
v0.1.2
Published
Javascript animation hero helpers kit
Downloads
10
Maintainers
Readme
sword.js
Getting started
npm i --save @trinketmage/sword
Core
- Clock: Object to handle a single render loop with RequestAnimationFrame and keep track of time.
Mathematics
- lerp: Linear interpolation.
- angleToVector: Calculate a 2d vector on unit circle from an angle in degree.
- vectorToAngle: Calculate an angle in degree from a 2d vector (with optional pivot).
Gesture
- VirtualScroll: Custom scroll handle for inertia.
3d
- getScreenPos: Screen position (2d vector) of position (3d vector).
- getFovHeigth: Get height of frustrum (y) at a specific depth (z).
glsl
- stagger: glsl implementation of staggers
#pragma glslify: stagger = require(@trinketmage/sword/src/glsl/stagger)
- backgroundCover: glsl UV calculation for background cover for fullscreen texture
#pragma glslify: backgroundCover = require(@trinketmage/sword/src/glsl/backgroundCover)