
- Posts: 5
- Joined: Thu Jul 21, 2022 2:17 am
- Real Name: Eric Hibbs
Hey y'all,
I'm trying to create a fusion macro / effect that operates on a sprite sheet and turns it into an animation.
I'm starting with this image:
And would like the following control interface:
Sprite Width (px): width of a single sprite
Sprite Height (px): height of a single sprite
Buffer (px): width buffer between sprites (seen in the example as blue lines)
Number of sprites in sheet
How many frames before moving to the next sprite
Animation style: Play Once, Loop, Ping-Pong
The desired output would be displaying each sprite in the sheet in sequence.
I've been a programmer for about 15 years so this feels like it should be an almost trivial problem to solve.
However, I'm really struggling with converting pixel measurements into expression values for Transforms, Masking Rectangles, etc.
As far as I can tell, the following math should work, but I have no idea where to get half these variable values.
Second issue: I know I need a Loader, a Rect mask, and a Transform. However, given that the math changes drastically based on the configuration of the nodes, I can't figure out where the mask should go (should it mask the loader directly, or an Xf node with the loader as input).
Any help would be very much appreciated
Edit: Oh and I just had the thought - maybe I should be directly using the image as a mediaIn instead of a Loader?? I can't express how frustrating it is to have the entire algorithm in my head and be stuck on the most basic steps because there's no documentation available.
I'm trying to create a fusion macro / effect that operates on a sprite sheet and turns it into an animation.
I'm starting with this image:
- The source sprite sheet
- Gruz Mother - Sleeping.png (137.06 KiB) Viewed 701 times
And would like the following control interface:
Sprite Width (px): width of a single sprite
Sprite Height (px): height of a single sprite
Buffer (px): width buffer between sprites (seen in the example as blue lines)
Number of sprites in sheet
How many frames before moving to the next sprite
Animation style: Play Once, Loop, Ping-Pong
The desired output would be displaying each sprite in the sheet in sequence.
I've been a programmer for about 15 years so this feels like it should be an almost trivial problem to solve.
However, I'm really struggling with converting pixel measurements into expression values for Transforms, Masking Rectangles, etc.
As far as I can tell, the following math should work, but I have no idea where to get half these variable values.
- Code: Select all
MaskWidth = SingleSpriteWidth / (FullImageWidth - (BufferWidth * (NumberSprites - 1))
- Code: Select all
TransformCenterX = MaskWidth / (2 + (CurrentSpriteIndex * BufferWidth))
Second issue: I know I need a Loader, a Rect mask, and a Transform. However, given that the math changes drastically based on the configuration of the nodes, I can't figure out where the mask should go (should it mask the loader directly, or an Xf node with the loader as input).
Any help would be very much appreciated
Edit: Oh and I just had the thought - maybe I should be directly using the image as a mediaIn instead of a Loader?? I can't express how frustrating it is to have the entire algorithm in my head and be stuck on the most basic steps because there's no documentation available.