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

As a developer, I'd like an option to hide content until its assets are loaded #16

Open
dankuck opened this issue Aug 6, 2019 · 1 comment

Comments

@dankuck
Copy link
Owner

dankuck commented Aug 6, 2019

I can't see where EaselJS offers this option explicitly. But it can be done.

For visual elements, any images can be loaded using new Image which has event handlers for this. Those can emit loaded. They should emit loading when they begin a new load operation. They can also inform their this.easel parent about loading/loaded.

Building from that, container elements should emit loading when one visual element is loading and they should emit loaded when there are none.

Finally, these elements should emit load-error when a load fails.

@dankuck
Copy link
Owner Author

dankuck commented Aug 22, 2019

Alternatively, a mixin could be created which provides a method called loadImage, and keeps track of loading images, then sets allImagesLoaded to true or false as appropriate.

Example:

<easel-container :visible="!allImagesLoaded">
  <easel-shape :form="rectangle" :dimensions="[200,200]" fill="blue"></easel-shape>
  <easel-text text="Loading..."></easel-text>
</easel-container>
<easel-bitmap :visible="allImagesLoaded" :image="loadImage('my-image.png')"></easel-bitmap>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant