dok11 / easy-prop-animation Goto Github PK
View Code? Open in Web Editor NEWEasyPropAnimation is a helpful class for Babylon.js that allows you easy to runs a property animations
License: MIT License
EasyPropAnimation is a helpful class for Babylon.js that allows you easy to runs a property animations
License: MIT License
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.
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 ๐
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.