Thanks to visit codestin.com
Credit goes to github.com

Skip to content

HTMLWriter, put initialisation of frames in setup #11897

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

Merged
merged 1 commit into from
Aug 22, 2018

Conversation

fredrik-1
Copy link
Contributor

Some initiation data in the HTMLWriter with embed_frames=True is not set to "zero" when the same writer is used another time. So the following code

writer=HTMLWriter(fps=1, embed_frames=True)
anim1.save('anim1.html', writer)
anim2.save('anim2.html', writer)

would result in an anim2.html animation that starts with the anim1 animation.

This pr move the initiation from __init__ to setup to avoid that problem.

It also set the correct Nframes in the embeded case. This doesn't seems to be necessary but it seems better and clearer when the variable is there. The only thing I think it does is to set

var frames = new Array(Nframes)

and Nframes=0 seems to work . I don't know javascript so I don't know if there are any important difference if the length of the Array is set before it is used or not.

I also deleted a variable that is not used anywhere.

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@dopplershift dopplershift added this to the v3.0 milestone Aug 20, 2018
@tacaswell tacaswell merged commit 2fb8c69 into matplotlib:master Aug 22, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 22, 2018
QuLogic added a commit that referenced this pull request Aug 23, 2018
@fredrik-1 fredrik-1 deleted the animation_html_setup branch August 28, 2018 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants