Skip to content
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

development: use new keyframe support of vizzu + add slider #24

Closed
simzer opened this issue Dec 17, 2022 · 6 comments · Fixed by #25
Closed

development: use new keyframe support of vizzu + add slider #24

simzer opened this issue Dec 17, 2022 · 6 comments · Fixed by #25
Assignees
Labels
enhancement New feature or request

Comments

@simzer
Copy link
Member

simzer commented Dec 17, 2022

Vizzu now supports multiple animations in a single animation call:

chart.animate(
 [
  {
    target: { data, chart, style },
    options: animOptions
  },
  ...
],
animopts)

Note: this feature is not released yet, but available from commit vizzuhq/vizzu-lib@3b73f2f
Available online here: https://vizzu-lib-main-sha.storage.googleapis.com/lib-3b73f2f/vizzu.js

The benefit of using this to pass slide phases together in one animate() call is that vizzu will consider this as a single animation.
This way adding a slider which can seek through all the phases becomes more simple.

@simzer
Copy link
Member Author

simzer commented Dec 17, 2022

Also, with this change: vizzuhq/vizzu-lib@03653ad, the whole animation (containing start, end, intermediate charts + anim options) can be stored and restored. Using this feature could simplify the current code.
Vizzu version hosted here: https://vizzu-lib-main-sha.storage.googleapis.com/lib-03653ad/vizzu.js
Example code repeating the previous animation:

chart.animate(...).then(chart => chart.animate(chart.animation.store()))

@dyuri
Copy link
Collaborator

dyuri commented Jan 2, 2023

@simzer I've removed the sub-slide concept and switched to keyframes - see my PR. Looks fine here.
I'd add the slider in a second step, but if this part works then it should be quite straightforward.

@simzer
Copy link
Member Author

simzer commented Feb 27, 2023

The animation control interface is changed. The animate method returns a promise, which still resolves when the animation is finished, but it does not incorporate the control methods. Instead, it contains another promise called 'activated', which resolves to the controller object when the animation starts.
See https://lib.vizzuhq.com/0.7/tutorial/animation_control_keyframes/

So doing something at the beginning of the animation looks like this:

chart.animate({...}).activated.then(control => ...);

For example storing the whole animation (start and end chart and the animation options between them:

var animation;
chart.animate({...}).activated.then(control => {
    animation = control.store();
});

Then resetting to a previously stored animation:

chart.animate(animation)

See: https://lib.vizzuhq.com/0.7/tutorial/shorthands_store/

@veghdev veghdev added the enhancement New feature or request label Mar 3, 2023
@veghdev veghdev changed the title Use new keyframe support of vizzu + add slider development: use new keyframe support of vizzu + add slider Mar 3, 2023
@simzer
Copy link
Member Author

simzer commented Mar 7, 2023

sorry, wrong issue, comment removed.

@simzer
Copy link
Member Author

simzer commented Mar 7, 2023

After discussion with @dyuri:
Fix needed in vizzu lib, to allow reverse playing of stored animation. see vizzuhq/vizzu-lib#166

@simzer
Copy link
Member Author

simzer commented Mar 7, 2023

vizzuhq/vizzu-lib#166 fixed

Animation can be played in reverse using these options:

chart.animate(anim, { position: 1, direction: 'reverse' });

Working example: https://jsfiddle.net/simzer/tfmjsunr/19/
pre-release url: https://vizzu-lib-main-sha.storage.googleapis.com/lib-66a2735/vizzu.js

@veghdev veghdev moved this to In Progress in vizzu-story: development May 3, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in vizzu-story: development May 9, 2023
@veghdev veghdev moved this from Done to Released-0.4.x in vizzu-story: development May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Released-0.4.x
Development

Successfully merging a pull request may close this issue.

3 participants