最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - PIXI.js - scrolling background grid - Stack Overflow

programmeradmin0浏览0评论

In the game agar.io, there is a grid background, and It scrolls with the player as they move. In PIXI.js, how would I go about recreating this? Preferably, in an efficient way that does not waste resources by rendering off-screen grid.

In the game agar.io, there is a grid background, and It scrolls with the player as they move. In PIXI.js, how would I go about recreating this? Preferably, in an efficient way that does not waste resources by rendering off-screen grid.

Share Improve this question edited Oct 2, 2019 at 15:25 user128511 asked Apr 18, 2018 at 17:47 eezeeeze 6481 gold badge7 silver badges23 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

You should use the PIXI.extras.TilingSprite class, created for the purpose of rendering repeatable patterns, tiles, etc. The class uses only one quad (two triangles) for the whole pattern, repeating is achieved in the fragment shader.

Here is a working example: http://pixijs.io/examples/#/basics/tiling-sprite.js

Here is documentation: http://pixijs.download/release/docs/PIXI.extras.TilingSprite.html

TilingSprite documentation / example has changed:

Example: https://pixijs.io/examples/#/sprite/tiling-sprite.js

Documentation: http://pixijs.download/release/docs/PIXI.TilingSprite.html

发布评论

评论列表(0)

  1. 暂无评论