Code Monkey home page Code Monkey logo

easy-prop-animation's People

Contributors

dok11 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

easy-prop-animation's Issues

Feature request: animation abort controller

Hi, when animation a camera position I would love to have an abort controller support so I can relinquish camera control to the user if they start trying to move the view.

Currently I use my own camera moving scripts and do this

const controller = new AbortController();
const canvas = scene.getEngine().getRenderingCanvas();

const onFocus = () => controller.abort();

canvas?.addEventListener('focus', onFocus);
canvas?.addEventListener('wheel', onFocus);

// move camera
await Promise.all([
  animateCameraTo(camera, scene, controller.signal),
  animateCameraTo({ ...camTarget, prop: 'target', duration: 500 }, scene, controller.signal),
]);

canvas?.removeEventListener('focus', onFocus);
canvas?.removeEventListener('wheel', onFocus);

and I think it would be a great addition to the run function.

Multiple animation snapping to end

Hi, when I have multiple animations with different durations all animations seem to snap to their final frame when the first duration is reached.

EasyPropAnimation.run(scene.activeCamera, {
  position: [camera.x, camera.y, camera.z],
  target: [camTarget.x, camTarget.y, camTarget.z],
  transition: 'target 0.5s cubic-bezier(0.4, 0, 0.2, 1), position 1.5s cubic-bezier(0.4, 0, 0.2, 1)',
});

I've fixed this in a local version of your code by converting all animations to an animation group and then playing, and returning, that animation group at the end of the run functions. I'm happy to do a pull request if that's the route you want to take.

An added bonus of using animationGroup is you gain observables on the entire group like so

console.log('animation start');

const anim = EasyPropAnimation.run(scene.activeCamera, {
  position: [camera.x, camera.y, camera.z],
  target: [camTarget.x, camTarget.y, camTarget.z],
  transition: 'target 0.5s cubic-bezier(0.4, 0, 0.2, 1), position 1.5s cubic-bezier(0.4, 0, 0.2, 1)',
});

anim.onAnimationGroupEndObservable.add(() => console.log('animation end'));

Thanks ๐Ÿ˜Š

Update Babylon Version

Is there any particular reason why Babylon v5 is listed as peer dependancy? From what I know, your library is working just fine with latest Babylon version(6.27.1), but I needed to import it manually without npm.

Both --legacy-peer-deps and --force is something I prefer to avoid if possible.

Thx

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.