Git Product home page Git Product logo

Comments (4)

mattdesl avatar mattdesl commented on June 2, 2024

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.

gre avatar gre commented on June 2, 2024

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.

micha149 avatar micha149 commented on June 2, 2024

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:

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.

kevzettler avatar kevzettler commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.