@makefully/dutifully 1.12.1 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.13.0
4
+
5
+ - Add `packfully` service client for packing images into texture atlases.
6
+
3
7
  ## 1.12.1
4
8
 
5
9
  - Preserve optional script-line `events` through Transcript for timed marker definitions.
package/README.md CHANGED
@@ -40,7 +40,7 @@ cheerfully({
40
40
  });
41
41
  ```
42
42
 
43
- ## Say (spoken notifications)
43
+ ### Say (spoken notifications)
44
44
 
45
45
  `say` generates short spoken phrases through Cheerfully's ElevenLabs service, caches the audio under `.cache/tts/`, and plays it locally via `node-web-audio-api`. Use it from npm scripts instead of wiring ElevenLabs into the consuming project:
46
46
 
@@ -109,6 +109,51 @@ This audio file process accepts ffmpeg commandline arguments to perform operatio
109
109
  }
110
110
  ```
111
111
 
112
+ ### Packfully
113
+
114
+ This image-to-atlas service packs PNG/JPG/WebP sprites into texture atlases and downloads atlas PNG(s) plus descriptor file(s).
115
+
116
+ ```javascript
117
+ {
118
+ "packfully": [{
119
+ "format": "texturepacker",
120
+ "src": "./example/sprites/",
121
+ "output": "./example/atlases/",
122
+ "options": {
123
+ "maxWidth": 2048,
124
+ "maxHeight": 2048,
125
+ "pot": true,
126
+ "smart": true,
127
+ "square": false,
128
+ "padding": 1,
129
+ "extrude": 1,
130
+ "border": 1,
131
+ "allowRotation": false,
132
+ "trim": true,
133
+ "trimThreshold": 0,
134
+ "prefix": "packed",
135
+ "scale": 1
136
+ },
137
+ "files": {
138
+ "hero.png": { "trim": false }
139
+ }
140
+ }]
141
+ }
142
+ ```
143
+
144
+ Use `exports: ["texturepacker", "createjs"]` (or `format`) to choose one or more atlas descriptors. Supported formats:
145
+
146
+ * `texturepacker` / `json-hash` / `pixi` / `phaser-hash` — TexturePacker JSON Hash
147
+ * `json-array` / `phaser-array` — TexturePacker JSON Array
148
+ * `createjs` / `easeljs` — CreateJS SpriteSheet JSON
149
+ * `spine` — Spine `.atlas` text
150
+ * `css` — CSS sprite classes
151
+ * `starling` / `sparrow` — Starling/Sparrow XML
152
+ * `unity` — Unity-oriented JSON
153
+ * `godot` — Godot atlas JSON
154
+
155
+ Spacing: `padding` is empty gap beyond `extrude`; `extrude` is edge-pixel bleed into that gap; `border` is margin from the atlas edge.
156
+
112
157
  ### Polly
113
158
 
114
159
  This text-to-voice service requires a script as input and will download audio VO generated by Amazon Polly. You can set Polly settings in `cheerfully.json` like so:
@@ -215,7 +260,7 @@ Cheerfully resolves these against caption timings and exports them in parallel u
215
260
 
216
261
  ## Example
217
262
 
218
- Find an example script in the `./examples/` folder. You can run either `npm run test-elevenlabs` or `npm run test-polly` to create VO tracks in the examples folder that you can then use to try out `npm run test-rhubarb` and `npm run test-transcription`.
263
+ Find an example script in the `./examples/` folder. You can run either `npm run test-elevenlabs` or `npm run test-polly` to create VO tracks in the examples folder that you can then use to try out `npm run test-rhubarb` and `npm run test-transcription`. Sample sprites for atlas packing are under `./example/sprites/`; run `npm run test-packfully` to pack them into `./example/atlases/`.
219
264
 
220
265
  These examples are specified using a JSON definition in `./cheerfully.json` which you can copy or modify to set different generation parameters as supported by Cheerfully.
221
266
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makefully/dutifully",
3
- "version": "1.12.1",
3
+ "version": "1.13.0",
4
4
  "description": "Client tools for Cheerfully service.",
5
5
  "main": "./src/index.js",
6
6
  "bin": {
@@ -19,6 +19,7 @@
19
19
  "test-allosaurus": "node ./cheer.js -service allosaurus",
20
20
  "test-elevenlabs": "node ./cheer.js -service elevenlabs",
21
21
  "test-ffmpeg": "node ./cheer.js -service ffmpeg",
22
+ "test-packfully": "node ./cheer.js -service packfully",
22
23
  "test-polly": "node ./cheer.js -service polly",
23
24
  "test-rasterize": "node ./cheer.js -service rasterize",
24
25
  "test-rhubarb": "node ./cheer.js -service rhubarb",
@@ -41,7 +42,10 @@
41
42
  "polly",
42
43
  "lipsync",
43
44
  "transcription",
44
- "captions"
45
+ "captions",
46
+ "packfully",
47
+ "atlas",
48
+ "spritesheet"
45
49
  ],
46
50
  "author": "Derek Detweiler <derek@makefullystudios.com>",
47
51
  "contributors": [
@@ -0,0 +1,15 @@
1
+ const
2
+ Cheer = require('./Cheer'),
3
+ Packfully = class Packfully extends Cheer {
4
+ beforeSend (archive) {
5
+ const
6
+ {src} = this.config;
7
+
8
+ if (src) {
9
+ archive.directory(src, false);
10
+ }
11
+ super.beforeSend(archive);
12
+ }
13
+ };
14
+
15
+ module.exports = Packfully;
package/src/index.js CHANGED
@@ -6,6 +6,7 @@ const
6
6
  allosaurus: LipSync,
7
7
  elevenlabs: require('./classes/ElevenLabs'),
8
8
  ffmpeg: require('./classes/FFMPEG'),
9
+ packfully: require('./classes/Packfully'),
9
10
  polly: require('./classes/Polly'),
10
11
  rasterize: require('./classes/Rasterize'),
11
12
  rhubarb: LipSync,