-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: can we animate programatic change of zoom/position? #34
Comments
The viewer.setZoom method The viewer.scrollTo method and the viewer.scrollBy method exist. |
I'm using these methods to set viewer position/zoom, however they just do it instantly, I was wondering if it would be possible to add an option to enable transition/animation to the new state? |
Would it be ok to provide it as |
I think duration makes sense, I'd just pass
And then obviously if you decide to add more arguments, you can just use same |
I'll develop this week (or until next week) |
infinite-viewer's new version is released. .setZoom(1.2, {
easing: (x: number) => number,
duration: 200,
});
.scrollTo(0, 0, {
easing: (x: number) => number,
duration: 200,
});
.scrollBy(0, 0, {
easing: (x: number) => number,
duration: 200,
}); |
Thanks a lot! I just tested it out, seems to be working, but now I realised that I might have an issue if I want to both re-center and reset zoom at the same time, i.e.:
This produces this really weird effect Screen.Recording.2022-10-03.at.21.34.29.movI don't see a method that I could use to both zoom and scroll at the same time, am I missing something or it's not there? Wondering if it would be possible to add that? Or maybe extend |
@bytasv infinite-viewer's new version is released.
viewer.scrollCenter({ duration: 5000, absolute: true }); |
Hey there,
I was wondering if it is possible to animate somehow the transition between whatever zoom and canvas position we currently have new values that I'd like to set?
I.e.: I want to reset the zoom to 100% and center canvas on some keyboard press, right now it immediately jumps to that setting, but I thought it would be nice to see even the quick transition in between. I could probably try to animate it with setTimout/raf but don't think it's gonna be a good result and maybe it wouldn't be too difficult to add some line in the code to have this functionality. 🤔
The text was updated successfully, but these errors were encountered: