Appearance
External player scripts (VS Code)
Write a project's player scripts in VS Code, use npm packages, and preview or publish from the terminal. Desktop app only.
In short: save the animation as a folder project, then right-click the scripts folder in the Library › Edit Scripts in VS Code…. HereSplash writes a package.json and the other project files and opens VS Code. From then on the files in scripts/ are the master copy: every time VS Code saves, the Library, the Properties panel, the Playback function lists and any open script tabs update at once. You can npm install any package, and Ctrl+Shift+B in VS Code asks HereSplash for a preview.
How to write the scripts themselves (Behaviour, fields, clip.timeline) is in the pixi-hm05 reference.
First-time setup
- In the desktop app: File › Save as Folder… (skip this if the document already is a folder project; a single
.hm5file is saved as a folder in step 2 first). - Right-click the scripts folder in the Library › Edit Scripts in VS Code…. HereSplash then:
- saves once, so the scripts on disk match the Library;
- writes the files below into the folder (files that already exist only get what they are missing);
- turns on "scripts are edited outside" for the document (saved in it);
- opens the folder in VS Code (through the
codecommand, else avscode://link, else the system's folder window).
- In VS Code's terminal:
npm install(installs thehm05package, TypeScript and the pixi.js types).
| File | Contents | When the file already exists |
|---|---|---|
package.json | scripts npm run preview / publish / build / typecheck / debug; devDependencies hm05, typescript, pixi.js (for its types only) | only the missing scripts / devDependencies are added |
tsconfig.json | type checking only; "pixi-hm05" points at the types inside the hm05 package | left alone (add the paths line to your own settings) |
.gitignore | node_modules/, output/, .hm05/ | missing lines are added |
.vscode/tasks.json | "hm05: Preview" (Ctrl+Shift+B) and "hm05: Publish"; errors are clickable | only these two tasks are added (comments in the file are lost) |
.vscode/extensions.json | recommends ESLint and Prettier | left alone |
.vscode/launch.json | "hm05: Attach to preview" (breakpoints, see below) | only this entry is added (comments in the file are lost) |
These files are not part of the animation: saving as .hm5 leaves them out, and saving in HereSplash never changes them.
A player script is a TypeScript (or JavaScript) module whose default export extends Behaviour:
ts
import { Behaviour } from "pixi-hm05";
export default class Hero extends Behaviour {
static fields = { speed: { type: "number", default: 3 } };
onEnterFrame() {
this.clip.x += Number(this.fields.speed);
}
}Everyday use
| To | Do this |
|---|---|
| Write or change a script | Edit the .ts / .js files in scripts/ in VS Code and save. HereSplash updates at once; nothing to press. |
| Add a script | Create the file in VS Code: it shows up in the Library straight away. New Script in HereSplash writes the file to disk at once too. |
| Rename / move | Renamed in VS Code: HereSplash recognises it (same contents) and keeps every binding. If the contents changed too, the Library item shows (file missing): right-click › Relink… and pick the new file. Renaming in the Library renames the file on disk. |
| Delete | Deleted in VS Code: the Library keeps the script and marks it (file missing) (bindings stay). Deleted in HereSplash: you are asked whether to delete the file as well (if not, it comes back into the Library the next time the project opens — the disk wins). |
| Preview | Ctrl+Shift+B in VS Code or npm run preview = Ctrl+Enter in HereSplash. npm run preview -- --watch previews again on every save (in the same preview window). |
| Breakpoints | npm run debug (preview, again on every save, debugging port 9333) → VS Code Run and Debug › "hm05: Attach to preview"; then click left of a line number in a .ts file. HereSplash must be started by this command (quit it first if it is running). Each save still reloads the whole page; the breakpoints stay. Without VS Code: press F12 in the preview window for DevTools. |
| Publish | npm run publish: publishes to output/ with the publish settings saved in the document, no dialog. |
| Check that it bundles | npm run build (errors come out as scripts/Hero.ts:12:4: error: …, clickable in VS Code's Problems panel). |
| Type-check | npm run typecheck (HereSplash does not type-check scripts itself). |
| Edit in HereSplash | The script tabs still work: they write to disk 0.4 s after you stop typing, and get an Open in VS Code button. Changed on both sides: the disk wins, and HereSplash tells you once. |
| Choose what double-click opens | Preferences › General › Open scripts with: HereSplash's code tab, VS Code, or the system's app for .ts / .js. |
The hm05 command
text
hm05 preview [--watch] [--debug] preview (--watch: again on every save; --debug: DevTools port for VS Code breakpoints)
hm05 publish publish to output/ with the document's publish settings
hm05 build bundle the scripts only, report errors
hm05 test [--frames N] play the project headless for N frames (default 120), print the page's console, exit 1 on errors
hm05 open open this project in HereSplash
hm05 init write the project files from the terminal (e.g. after git clone)Run it in the project folder (the one with doc.json) or a folder inside it, or name the project after the command (hm05 build ../game). If the desktop app is running the command connects to it, otherwise it starts the app (waits up to 30 seconds). There is nothing to set up: the desktop app writes its address to ~/.hm05/bridge.json and the command finds it. Full list: hm05 CLI.
npm packages
- Desktop folder project:
npm install gsapin VS Code's terminal, thenimport gsap from "gsap"in a script. Preview and Publish readnode_modulesdirectly and bundle everything into<name>.scripts.js; the published page fetches nothing else from the internet. pixi-hm05,pixi.jsandpixi-filtersare always the page's own copy (pixi is never bundled twice).- When saving, HereSplash copies the
dependenciesofpackage.json(at the installed versions) into the document's Script Packages, so the same document can also be published from the web editor or as a.hm5file. - Web editor or a single
.hm5file: right-click scripts in the Library › Script Packages…, type a package name, and the latest version is filled in (you can change it). Publish fetches that version from a CDN (esm.sh by default; jsDelivr in Preferences) and bundles it the same way. Fetched files are kept in the browser, so the second time nothing is downloaded. - A package that is neither in Script Packages nor installed gives the error
Cannot find package "gsap": run npm install; the latest version is never fetched on its own. - Not supported: packages that need Node built-in modules (
fs…) or files that must be built first (.vue, CSS imports). You can import.json(data),.txt(text) and other.tsfiles of the folder (for examplesrc/utils.ts; they do not become Library items).
Known limits
- The
hm05npm package is not published yet. Until it is, the project'spackage.jsonpointshm05at the copy that ships inside the app (afile:path); it works the same. - Network drives and Windows drives mounted in WSL may not report file changes: HereSplash compares the files again whenever its window gets the focus.
- File › Export › Export Animation… with Loadable animation or Complete web page still bundles the Library's scripts and Script Packages (not
node_modules); Publish, Preview and thehm05command read the disk.