Thirdparty Integration: Using Texture Packer for single file assets

Here is an additional export (based on the responsive exporter) that sets the mask properties to a file of the same name but with a -mask.png extension. That image is not created for you but can be added …

Installation:

  1. Unpack the folder somewhere central but permanent (like your Documents-folder)
  2. Open Texture-Packer and navigate to the settings and select the unpacked folder as your additional extension folder (more on that here)

Hint on installing chose the enclosing folder in step (Installation, Step 2):
:white_check_mark: your-path/Texture-Packer-Exporter/
:x: your-path/Texture-Packer-Exporter/css-mask/

Usage:

  1. Import PNG assets into Texture Packer
  2. Select the new exporter, should be CSS (responsive, retina, mask)
  3. Export it once as PNG
  4. Export it finally as JPEG

use the PNG to create your -mask.png-Version (only the alpha channel) and if needed (re)export your JPEG version in the lowest quality acceptable from the PNG source. If you don't like the automatic background color the PNG-->JPEG conversion automatically determines… this (re)export step can also be used to customize the color.

Now import the following into your Hype-Project:

  1. CSS file from Texture Packer (custom exporter)
  2. the (re)exported JPEG-file
  3. the (re)exported PNG-Alpha-channel-file

Now assigning the class name corresponding to the filename should display the element on the Hype stage using a mask while giving control over the image and mask separately.

Example Result:
Texture-Packer-Custom-Mask-Exporter-Example.hype.zip (176,3 KB)

Custom Texture-Packer-Exporter:
Texture-Packer-Exporter.zip (9,0 KB)

2 Likes