Comments (4)
That's just two resources, a json file and an image file.
from resource-loader.
from resource-loader.
This library just downloads things, what you do with what is downloaded is up to you.
loader.add('json', jsonUrl).add('img', imageUrl).load(() =>
{
console.log(loader.resources.json);
console.log(loader.resources.img);
});
from resource-loader.
@englercj I understand his question,
The same thing happened to me and I don't know how to solve it.
For a simple project where I had atlas.json and atlas.png in the same loader, I would do
loader
.add("images/atlas.json")
.load(() => {
let sprite = new Sprite(
resources["images/atlas.json"].textures["frameId.png"]
);
});
However, now that I am using webpack and I inline assets with base64 into HTML, I have to import those assets at the top like this
import atlas_texture from 'assets/atlas.png;
import atlas_json from 'assets/atlas.json;
however, I cannot load them, in the same way, I did before.
I found a solution to do something like this
loader.add({url: atlas_texture, name: 'texture'}).load(() => {
const sheet = new Spritesheet(
Loader.shared.resources['texture'].texture.baseTexture,
atlas_json
);
sheet.parse((...args) => {
console.log(sheet.textures);
});
});
However it is still not perfect, because this way I don't have my textures ready by the time I am in load()'s callback. Do you know a way to fix it?
Also, as I talked about this issue, because my assets now are base64, I don't know how to load spine animations either. Can you provide an example of how I can do that?
from resource-loader.
Related Issues (20)
- Missing documentation? HOT 3
- ESM module & TS typings HOT 1
- Question re. handling errors on sub-resources in custom middleware HOT 4
- Version 3.0.0 is not transpiled
- Chrome Mobile Incognito Error HOT 1
- Best way to add new resource types and loading strategies? HOT 5
- Adding an asset more than once HOT 3
- Pixi resource-loader - add timeout to XHR request HOT 1
- may i load plist file from texturepacker? HOT 2
- Feature request: Font loading via CSS Font Loading API HOT 4
- Reload failed resources HOT 1
- Resource type as generic HOT 4
- Use resource-loader in a test (jest) context HOT 2
- Firefox fails to fire progress event without preload attribute HOT 3
- Question Load SVG inline HOT 5
- How to check for video progress? HOT 3
- Pixi Loader use multiple times error HOT 1
- ResourceLoader.add(...) does not operate like a queue HOT 4
- parse-uri breaks ES5 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from resource-loader.