Comments (4)
A tile object is an object with two properties:
- "src" is the path and filename of the image
- "id" is an optional property which can be used when defining the order of the tiles in the tileCollection
Here is an example of a tileCollection consisting of 4 tile instances. The top two tiles are the same sky image and the bottom two tiles are two different ground images:
var background = BLOCKS.tileCollection({
order: [["sky", "sky"], ["groundLeft", "groundRight"]],
tiles: [{
id: "sky",
src: "mars-surface.png"
}, {
id: "groundLeft",
src: "ground-left.png"
}, {
id: "groundRight",
src: "ground-right.png"
}]
};
from blocksjs.
Do I need to use BLOCKS.preloader first or something like this? I get this error: "Cannot read property 'width' of undefined"
from blocksjs.
Yes, that should fix the issue. The tileCollection expects a preload loaded image since it uses the image dimensions to define the tile size. I'll look into adding a warning. You can use the BLOCK.preloader or if you want to preload the images yourself just assign the preloaded image to and "image" property for each of the tile definitions.
from blocksjs.
I removed the requirement for preloading the first tile image before creating a tileCollection in release 0.5.13. The image will still need to be loaded but the tileCollection should stay out of error town until the first tile image is loaded.
@JumpLink Please let me know this resolves your issues.
from blocksjs.
Related Issues (2)
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 blocksjs.