Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Dragosha/defold-sprite-repeat
Texture repeat (tiling) shader. For Sprites and GUI box nodes.
https://github.com/Dragosha/defold-sprite-repeat
defold defold-module defold-shaders
Last synced: 4 months ago
JSON representation
Texture repeat (tiling) shader. For Sprites and GUI box nodes.
- Host: GitHub
- URL: https://github.com/Dragosha/defold-sprite-repeat
- Owner: Dragosha
- License: mit
- Created: 2024-03-26T18:18:46.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-07-27T08:23:12.000Z (6 months ago)
- Last Synced: 2024-10-04T22:08:15.977Z (4 months ago)
- Topics: defold, defold-module, defold-shaders
- Language: Lua
- Homepage:
- Size: 297 KB
- Stars: 19
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-defold - Sprite texture repeat shader
README
# Sprite texture repeat shader. (or tiling)
---
Set 'sprite_repeat' material to the sprite. Directly in the editor or with code.```lua
go.set(self.url, "material", self.repeat_material)
```Create and go our super-puper repeating magic.
```lua
local sprite_repeat = require('sprite_repeat.sprite_repeat')function init(self)
local repeat_x = 4
local repeat_y = 4local sr = sprite_repeat.create("#sprite_url")
sr.animate(repeat_x, repeat_y)end
```See file 'sprite_repeat.script' for details.
Works with both static and animated sprites.
![Example](example.png)
# GUI box node texture repeat shader.
---
Set 'node_repeat' material to the box node. Directly in the editor or with code.```lua
gui.set_material(node, "gui_repeat")
```Setup constants to the material shader:
```lua
local node_repeat = require('node_repeat.node_repeat')
....
local nr = node_repeat.create(node, nil, atlas_path)
nr.animate(repeat_x, repeat_y)
```Update the repeat factors if need:
```lua
nr.update(1, 4*y)
```See 'test.gui_script' for details.
---
Happy Defolding!
---