Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spritesheet animation handling. Also fix several minor issues #275

Merged
merged 42 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
55d52cd
Add spritesheet animation handling and fix several minor issues
Codas Jul 23, 2024
3acf55b
Fix .template() not overriding db specified template
Codas Jul 23, 2024
4af202e
Fix playbackRate breaking syncGroups and loops
Codas Jul 24, 2024
4051a1f
Address pr review comments
Codas Jul 29, 2024
8141ade
Add .DS_Store files to gitignore
Codas Aug 9, 2024
af6b014
Merge branch 'master' into spritesheets
Codas Aug 9, 2024
8eff936
Fix attachTo with bindScale errors
Codas Aug 9, 2024
ea2d928
Merge branch 'master' into spritesheets
Codas Aug 10, 2024
a315aa4
Fix spritesheet animations currentTime / duration calculation
Codas Aug 11, 2024
1581664
Merge branch 'master' into spritesheets
Codas Aug 13, 2024
8b32318
Merge branch 'master' into spritesheets
Codas Aug 18, 2024
0a31980
Merge branch 'master' into spritesheets
Codas Aug 19, 2024
a50017d
Merge remote-tracking branch 'wasp/master' into spritesheets
Codas Sep 1, 2024
787f0fc
Create batchable, vision masking, optionally tileable base effect shader
Codas Sep 16, 2024
b8ee848
Spritesheet player for sequencer database viewer
Codas Sep 17, 2024
7f31adf
Add custom fps for flipbooks
Codas Sep 18, 2024
2226055
Add color matrix application to batchable vision sampler shader
Codas Sep 23, 2024
dd64ac0
Fix some tiling issues
Codas Sep 24, 2024
7642d3e
sprite manager refactor, allow for easier hot replacement of assets
Codas Sep 24, 2024
6a2e6c9
Merge branch 'master' into spritesheets
Codas Sep 27, 2024
1e399c1
Merge branch 'master' into spritesheets
Codas Sep 28, 2024
01ff75f
Add JIT spritesheet compilation and compression
Codas Oct 4, 2024
9976677
Merge branch 'master' into spritesheets
Codas Oct 4, 2024
4462498
Clean up dependencies
Codas Oct 4, 2024
557804d
Fix effect shader after merge...
Codas Oct 4, 2024
9eb42c7
Re-use cached video file for spritesheet generation if available
Codas Oct 4, 2024
f1c944b
Fix memory leak for video base texture after spritesheet generation
Codas Oct 4, 2024
e778ec9
Fix formatting, alpha trimming
Codas Oct 4, 2024
84b6362
Use premultiplied alpha for spritesheets
Codas Oct 4, 2024
3f31d65
Add semi-persistent offline cache for compiled spritesheets
Codas Oct 4, 2024
ad93b00
Add feature detection for spritesheet generator
Codas Oct 5, 2024
8058a9b
Use correct frameRate for spritesheets, formatting, feature detection…
Codas Oct 5, 2024
80777b4
Fix size calculations, cleanup
Codas Oct 5, 2024
ea00dcc
Resolve issue with frames not being closed if frame is 100% transparent
Codas Oct 5, 2024
d20cfcd
Increase cached file size to 40MB to include some more marker effects
Codas Oct 5, 2024
277221b
Fix issue with multiple jobs for the same file being created
Codas Oct 5, 2024
11dd17f
Fix astc and bc7 compression flag being switched
Codas Oct 6, 2024
02efb2e
Merge branch 'master' into spritesheets
Codas Oct 12, 2024
d5a94da
Merge branch 'fix-shape-fade-in-out' into spritesheets
Codas Oct 15, 2024
70b1fe1
Merge remote-tracking branch 'wasp/master' into spritesheets
Codas Oct 18, 2024
478c17a
Add changelog, spritesheet database documentation
Codas Oct 18, 2024
c091eef
Verify cached spritesheet source with simple hashing function
Codas Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions docs/api/effect.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ In addition, a secondary options parameter can be given to this method, which ha
- `offset: object` (default `{ x: 0, y: 0 }`) - causes the location to be offset by a set amount
- `local: boolean` - Used with `offset` to cause the location to be offset locally to the effect's rotation
- `gridUnits: boolean` - Used with `offset` to make each whole number represent in `x` and `y` to represent the effect's scene's grid size
- `template: boolean` - Make the effect use the defined template in the sequencer database. See [Why templates are useful](https://fantasycomputer.works/FoundryVTT-Sequencer/#/database-basics?id=why-templates-are-useful).

## Rotate Towards

Expand Down Expand Up @@ -872,8 +873,6 @@ Animatable properties are as follows:
- `scale.y`
- `width`
- `height`

- `alphaFilter`
- `alpha`

- `spriteContainer`
Expand Down Expand Up @@ -924,8 +923,6 @@ Animatable properties are as follows:
- `scale.y`
- `width`
- `height`

- `alphaFilter`
- `alpha`

- `spriteContainer`
Expand Down
63 changes: 63 additions & 0 deletions examples/effects/13-rotateTowards-template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
(async () => {
ui.notifications.info("Rotate towards different positions. Left is original scale, right are scaled variants");
const buildStar = (center, scale = 1) => {
for (let row = -1; row <= 1; row++) {
for (let col = -1; col <= 1; col++) {
if (!col && !row) {
continue;
}
new Sequence()
.effect()
.file("jb2a.energy_beam.normal.bluepink.03.15ft")
.atLocation(center)
.rotateTowards({ x: center.x + col, y: center.y + row }, { template: true })
.scale(scale)
.play();
}
}
};
buildStar({ x: 1400, y: 1400 });
buildStar({ x: 2100, y: 1400 }, 0.75);
buildStar({ x: 2900, y: 1400 }, 1.25);

ui.notifications.info(
"Below, rotation straight to the right (control) and offset by +/- 45 deg. Right is offset by +/- 100 units"
);
new Sequence()
.effect()
.file("jb2a.energy_beam.normal.bluepink.03.15ft")
.atLocation({ x: 1400, y: 2000 })
.rotateTowards({ x: 1500, y: 2000 }, { rotationOffset: 45, template: true })
.play();
new Sequence()
.effect()
.file("jb2a.energy_beam.normal.bluepink.03.15ft")
.atLocation({ x: 1400, y: 2000 })
.rotateTowards({ x: 1500, y: 2000 }, { rotationOffset: -45, template: true })
.play();
new Sequence()
.effect()
.file("jb2a.energy_beam.normal.bluepink.03.15ft")
.atLocation({ x: 1400, y: 2000 })
.rotateTowards({ x: 1500, y: 2000 }, { template: true })
.play();

new Sequence()
.effect()
.file("jb2a.energy_beam.normal.bluepink.03.15ft")
.atLocation({ x: 2000, y: 2000 })
.rotateTowards({ x: 2300, y: 2000 }, { offset: { y: -100 }, template: true })
.play();
new Sequence()
.effect()
.file("jb2a.energy_beam.normal.bluepink.03.15ft")
.atLocation({ x: 2000, y: 2000 })
.rotateTowards({ x: 2300, y: 2000 }, { offset: { y: 100 }, template: true })
.play();
new Sequence()
.effect()
.file("jb2a.energy_beam.normal.bluepink.03.15ft")
.atLocation({ x: 2000, y: 2000 })
.rotateTowards({ x: 2300, y: 2000 }, { template: true })
.play();
})();
21 changes: 21 additions & 0 deletions examples/effects/52-spritesheets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(async () => {
const textStyle = {
dropShadow: true,
dropShadowAngle: 0,
dropShadowBlur: 10,
dropShadowDistance: 0,
fill: "#ffffff",
fontStyle: "oblique",
miterLimit: 2,
strokeThickness: 5,
};

new Sequence()
.effect()
.file("modules/sequencer/samples/spritesheets/fire.json")
.atLocation({ x: 1200, y: 1100 })
.scale(2)
.text("spritesheet", {...textStyle, anchor: {x: 0.5, y: -2.5}})
.duration(5000)
.play();
})();
34 changes: 34 additions & 0 deletions examples/effects/53-stresstest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
(async () => {
// WARNING: this is taxing on the system, executing this script with sequencer 3.2.11 on time of writing
// will most likely make your world unresponsive. Safer values for cols and rows would be 10x15
const assets = [
{ name: "video", file: "modules/sequencer/samples/fire.webm", cols: 30, rows: 22 },
{ name: "spritesheet", file: "modules/sequencer/samples/spritesheets/fire.json", cols: 30, rows: 22 },
];

const effectSize = 120;
const effectGridSize = 120;

for (const { name, file, cols, rows } of assets) {
ui.notifications.info(`Now playing ${name} effects`);
await Sequencer.Helpers.wait(250);

const start = { x: 1200, y: 900 };
const seq = new Sequence();
for (let row = 0; row < rows; row++) {
for (let col = 0; col < cols; col++) {
seq.effect()
.file(file)
.atLocation({
x: start.x + col * effectGridSize,
y: start.y + row * effectGridSize,
})
.size(effectSize)
.duration(20 * 1000);
}
}

await seq.play({ preload: true });
await Sequencer.Helpers.wait(21 * 1000);
}
})();
Binary file added samples/fire.webm
Binary file not shown.
Binary file added samples/spritesheets/fire.basis
Binary file not shown.
Loading