Skip to content

Player animation #24554

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mikaeltulldahl
Copy link

PR Summary

-Fix bug in Animation where the animation resumes when resizing window
-Make Button and Slider blittable
-Add PlayerAnimation class with play/pause, time functionality

this is still work in progress, I just thought it was done enough to get some feedback regarding if this is the way to go

should solve #20564
but with a bit less features. but if we actually want all those buttons, it's easy to add
could also add a speed slider/button for slow-motion/fast-forward effects

Known Bugs:
-PlayerAnimation does not work so well when blitting is turned off
-The slider get some strange artifacts with blitting(I have no idea why)
-The sliders value text does not update with blitting(I have no idea why)

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@mikaeltulldahl
Copy link
Author

looks like I need to rebase my two commits, but latest main branch didn't seem very stable. any recommendations?

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@mikaeltulldahl mikaeltulldahl marked this pull request as ready for review November 27, 2022 21:27
@oscargus
Copy link
Member

I think that the animation module has seen some work recently, so that is probably the reason for the need to rebase. In general, the approach is just to keep up rebasing in case of conflicts, although, of course, review can happen in parallel.

if self.useblit:
self.label.set_animated(True)
self.ax.patch.set_animated(True)
self.background = self.canvas.copy_from_bbox(self.ax.bbox)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think it is safe to assume that we have drawn the figure at least once here, we need to defer this to the first draw event.

@tacaswell tacaswell added this to the v3.7.0 milestone Nov 28, 2022
@tacaswell
Copy link
Member

We are 👍🏻 on force-pushing to feature branches (as you did). Unfortunately if you are changing lines that are being worked on in parallel you are going to have to resolve the merge conflicts.

ONE_FORWARD_SYMBOL = "$\u29D0$"

def __init__(self, func, init_func, min_value=0, max_value=100,
pos=(0.125, 0.92), valstep=1, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to need a docstring including the required signatures of the functions passed in.

@tacaswell
Copy link
Member

This is cool work and am supportive of it going in, however I have some concerns about the blitting implementation in the widgets (being more careful about when we are sure that the background has been drawn at least once and all of the sizes are correct etc) and that this is documented well enough that someone can understand what the signatures of the functions passed in need to be passed in.

Rather than using make_adjustable, I think it would be better to make use of the new SubFigure functionality + subplot mosaic to layout the UI (and maybe as a stretch make it possible to pass in the axes to be used for the UI).

@@ -400,6 +429,8 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt=None,
super().__init__(ax, orientation, closedmin, closedmax,
valmin, valmax, valfmt, dragging, valstep)

self.useblit = useblit and self.canvas.supports_blit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this sort of thing live in SliderBase?

If blitting is going to be supported on slider then it ought to also be supported on RangeSlider

@QuLogic
Copy link
Member

QuLogic commented Nov 29, 2022

Button blitting is implemented in #23457.
Slider blitting is implemented in #23439, but the trouble there, as you have found, is that there is no good way to blit the text generically.

@mikaeltulldahl
Copy link
Author

great, I will probably just wait until those fixes are merged then

@tacaswell
Copy link
Member

I am going to push this to 3.8 as I am not confident that we will both of those other PRs resolved and have time to get this re-implemented on top of them by the end of the month.

@jklymak
Copy link
Member

jklymak commented Jan 30, 2023

Moving this to draft. @mikaeltulldahl Hopefully you come back to it after the PRs above are merged!

@jklymak jklymak marked this pull request as draft January 30, 2023 23:27
@ksunden ksunden modified the milestones: v3.8.0, v3.9.0 Aug 9, 2023
@QuLogic QuLogic removed this from the v3.9.0 milestone Mar 13, 2024
@QuLogic QuLogic added this to the v3.10.0 milestone Mar 13, 2024
@ksunden ksunden modified the milestones: v3.10.0, future releases Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

7 participants