Comments (4)
I've been doing a bit of motion/easing stuff here and there:
https://www.npmjs.com/package/eases
https://www.npmjs.com/package/lerp
https://www.npmjs.com/package/lerp-array
https://www.npmjs.com/package/keyframes
I've also explored a pretty high-level tweening engine:
https://www.npmjs.com/package/tweenr
It has some useful bits under the hood (like matrix decompose / recompose for CSS transform tweening) so if you have suggestions on how to make the modules more generic and less tied to an "engine" I'd appreciate the feedback. ๐
EDIT: Also worth pointing out some GL specific modules.
https://www.npmjs.com/package/glsl-easings
https://www.npmjs.com/package/glsl-transition
from contributing.
glsl.io / glsl-transition / diaporama are actually all using https://github.com/gre/bezier-easing which implements the cubic-easing (like in CSS) in JavaScript
from contributing.
I also stuck on this issue some days ago. I needed to animate some objects from A to B and then to C. All solutions I found were to hard coupled to css or some other platforms, so I decided to make my own quick implementation. My stack consits of the following components:
- https://www.npmjs.com/package/ease Why? Be cause it consumes floats between 0 and 1 and returns a interpolated float between 0 and 1
- https://www.npmjs.com/package/d3-interpolate Creates a interpolator function based on two states. The interpolator expects a value between 0 and 1 and returns the interpolated object/array/string/number/whatever
- A simple timeline implementation
Usage example:
import {cubicIn} from 'ease';
import {array as createInterpolator} from 'd3-interpolate';
const A = [1, 2, 3]; // vec3
const B = [4, 5, 6]; // vec3
const C = [7, 8, 9]; // vec3
const interpolateA2B = createInterpolator(A, B);
const interpolateB2C = createInterpolator(B, C);
const animation = new Timeline()
// add a handler for interpolate a point from A to B with duration of 200ms
.addHandler(200, t => point = interpolateA2B(t))
// adds a delay between handlers
.delay(100)
.addHandler(500, t => point = interpolateB2C(cubicIn(t)));
loop.on('tick', dt => {
// increases a internal age and calls matching handler
animation.tick(dt);
// render your point
});
If there is any interest, I can open source the timeline moduleโฆ
from contributing.
Going to recommend https://github.com/AndrewRayCode/easing-utils
Easing functions for Javascript that take a number from 0 to 1 and return the eased value
from contributing.
Related Issues (20)
- Quad meshing/remeshing tools HOT 2
- Constrained Delaunay triangulation/tetrahedralization HOT 2
- Physics simulation HOT 1
- Image segmentation
- Skeletal animation
- HDR image processing
- Sophisticated camera effects
- Finish porting gl-matrix modules over HOT 4
- Texture synthesis HOT 2
- 2D shapes / primitives HOT 1
- 2D / 3D Text Rendering HOT 1
- GPU algorithms
- Docs repo
- simplicial complexes / "meshtypes" HOT 8
- Uniform initialisation
- glsl-js donation HOT 4
- Support instanced rendering HOT 1
- Type definitions?
- New logo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from contributing.