I like to animate the phase offsets of patterns to create simple animated texture effects. However, the 8x8 size is quite limiting — I often wish I could get just a little more detail and/or a little more distance before the pattern repeats. Those pixels are tiny!
This is a multipart request, as I can see two independently useful ways to achieve what I'm after.
- I'd love support for 16x16 (HD? ) patterns. I suspect there are probably good technical reasons (e.g. performance) that it's constrained to 8x8, but this would address most of my current use cases.
- A way to draw an arbitrary
image
withx
andy
phase offsets. This could take a standalone form as inimage:drawPhased(xPhase, yPhase)
, or be added to the provided image tiling capability as inimage:drawTiled(x, y, width, height, [flip], [xPhase, yPhase])
This could be used to:
- Achieve animated tiled pattern effects of arbitrary size
- Render simple looping image elements or even whole backgrounds/scenes
Is there a good technique for achieving this effect already in the SDK? I suppose it would be possible by using image:draw(x, y, [flip, [sourceRect]])
by stitching together draws using sourceRect
s for each half (or each quadrant, if phasing in both axes), but that feels cumbersome to set up and potentially non-performant.
Thanks!