Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
feat: make visual motion window-native
kashorin8fc6d30e1f08
diff --git a/examples/talking-film-graph-check/svml.packages.lock b/examples/talking-film-graph-check/svml.packages.lockindex 2ebad537..6455b1b9 100644--- a/examples/talking-film-graph-check/svml.packages.lock+++ b/examples/talking-film-graph-check/svml.packages.lock@@ -554,7 +554,7 @@{"name": "@narratage/caption-fine","version": "0.0.0-dev",- "digest": "sha256:b3629ec8e280ac0ab5fa4e92500b7d762974e97600f8021bfc4b0a8694ae593b"+ "digest": "sha256:8094384ca1980ee72e0a5621a7ee9d62aec167521fdb536eb068eeeecee2ec9c"},{"name": "@narratage/caption-gemini",@@ -574,7 +574,7 @@{"name": "@narratage/composition","version": "0.0.0-dev",- "digest": "sha256:acc55c73eaf46558b695532a495bc078a72337ac727b97eaf412bc7147336d76"+ "digest": "sha256:c9bfd8e6d07dc38a14f622b4ce545752dee7df09c2458d4e4798dc87eb9ce997"},{"name": "@narratage/core",@@ -609,7 +609,7 @@{"name": "@narratage/hyperframes","version": "0.0.0-dev",- "digest": "sha256:cd4b8c4cfb11307e0a487fa5d065a961c1cfb701a48f6d293f98b90c6d01b5cb"+ "digest": "sha256:cbe9359d2a59fcde65e3b8d4fef43c9965b5e825b2d517fb25babad4c18ed512"},{"name": "@narratage/markup",@@ -624,7 +624,7 @@{"name": "@narratage/media-track","version": "0.0.0-dev",- "digest": "sha256:d371b1bdc8747fef280640dbc8a9cb03acde9322ad8e6f11ed02396ff8f53260"+ "digest": "sha256:073650e06f85a84f9757ab2fd1da414a51687a135257c91c7f8919d9096274d0"},{"name": "@narratage/media",@@ -734,7 +734,7 @@{"name": "@narratage/typography-track","version": "0.0.0-dev",- "digest": "sha256:d032d7f7e034803d6253c9b9082f6ddd30bff95719325f6524e87b84c6c5af7f"+ "digest": "sha256:49238db6019100687c41ba36c50db138889a4adfe5d91a0fe165629db577171a"},{"name": "@narratage/validation",@@ -778,7 +778,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:c5616408dd56ce9c903523319b2a697ff6b8af5bfe1dc66fe793a11e4629f3cf",- "closureDigest": "sha256:3cf5629f0b0b0104e5bd6342ef0ba05e3f22ba22fa62fb9e079eec90dec2fb75"+ "closureDigest": "sha256:f9e91adc137a2bd2d4bd726b99d1943aacf285453468f67864e00a70d2ab24ac"},{"specifier": "@narratage/caption-gemini",@@ -796,7 +796,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:0a988b665baf0846246e309d9faf39ffb3ef6ec455bf37f7c438eb30429ff46e",- "closureDigest": "sha256:abcc228356713b66fd2125b2bdd66679df75d8e0d39c5fd1fbacac133317c0ce"+ "closureDigest": "sha256:99ab833c7be2e6ce9591f5aebeef43cec6b327b126f2c174591af01cb56290a9"},{"specifier": "@narratage/film",@@ -805,7 +805,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:8e58b5630b9a68a8ce7314620f5f1c7cda973a05c179c18d61e10d68002964f0",- "closureDigest": "sha256:bcad5a1643f1b1193b79c726ce03b4ce50929652814567712d66c596599f272f"+ "closureDigest": "sha256:cca6cb3b76b6e0744ee9ad00b666076e1db5098e39a8b844d432002019d2b75b"},{"specifier": "@narratage/fonts-open",@@ -832,7 +832,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:b8b8773d03f19844cdc8d714650380145056649245e33c607f30220fff194157",- "closureDigest": "sha256:242c745bb6a51cd17dbfc9c9aa3408464b9bb14d6eab26bdebd35bcc0f958014"+ "closureDigest": "sha256:0652bed735647218d6f25a1e5dd2be5341f9a387a7fa5b5748865058bae4cd55"},{"specifier": "@narratage/media",@@ -850,7 +850,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:b7bf62142837adc7bad4f8c4b74b60ee6b4ade74140788cf4b682c140893b4af",- "closureDigest": "sha256:4a96ed320c8c32a65b6d93fb671f19562c1178b15ac89b268876e9c3c268df28"+ "closureDigest": "sha256:3ed0d2f8a7e8d0f3bbb3c4a1ee354967afe24311cd567f562ad766bdca52387c"},{"specifier": "@narratage/media-track",@@ -859,7 +859,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:b3e32ad8fd0f074d9e7cb707383e45c79f89ed1c28044f6d70294c96411cb393",- "closureDigest": "sha256:67c8618e8047675b9b315bab6c91e57d51c8f9264fe6f185a12b08c3e05db438"+ "closureDigest": "sha256:a63876d7b1b9326f77f05ca6cb180e0bbc60309cde461ca449da4717cb0e0968"},{"specifier": "@narratage/narrative",@@ -886,7 +886,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:965f293a64a8b1c7ae87e6e13986a751d4c26a2fcded9dd81fc24a7790980b45",- "closureDigest": "sha256:0c046a66947a9ef4cccc89f589b0eb9841bf668cdbdf1ef80f69eefaa34741bf"+ "closureDigest": "sha256:7f0830d7c6714b686acbd3159b4980ffe95f99100e330ac252506e8972b8186a"},{"specifier": "@narratage/run-markup",@@ -958,7 +958,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:f01f21badb0ccdd5cc62b131be05f46030bffee96042c7323a0c572786d012ef",- "closureDigest": "sha256:fb0cab2d5cc764267e5891938e2f3a4beec8706e96821e4906d290fbb7eb1be7"+ "closureDigest": "sha256:d8fbec79bf12bbac90f72e2040c9467f79c285b1e01ed4c9e7e5f36cb117e5b2"},{"specifier": "@narratage/speech-evidence",@@ -976,7 +976,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:c2d3ae7c5a676c66368c9225fd516aa6cfa7dab749123f7ecd31007628ee4666",- "closureDigest": "sha256:d0e8ca2fc3403689d8edb798787c61c934ce31a895bb779f2db9a7fdda93af00"+ "closureDigest": "sha256:38365376d684cb70f6d0e939042320c7ac309f8c4272affb0c2a91890419e45c"},{"specifier": "@narratage/svs",@@ -1012,7 +1012,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:a8193c2426018cccfc1ca9911b4d1aed7f9499b17196e14f858797b8d109bd13",- "closureDigest": "sha256:50e46db546a27733cc395b2ea48974026575890c09394ad2b7eb4da99a1e60c9"+ "closureDigest": "sha256:9ff99221ec12e2cce266def733e5a65388b5302a62b3b73004bdcdc3137d1a16"},{"specifier": "@narratage/visual-ir",@@ -1030,8 +1030,8 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:be22a14fb7f6eb437aa17b541a35320f5e26b77d7d9925702b2977609f874fe3",- "closureDigest": "sha256:a2724330f6ee6fd5ff6e804d440236852819e57c67f123b04c486a5a964027a7"+ "closureDigest": "sha256:4b2e7e4d12e50b6b8dad43c2c080dd6d5d04475a155e22cf35bb61069bba1f8a"}],- "digest": "sha256:6d100564480d64e4c538e98ffb63877b3d62550bae40d40ae0dba34ce5a37b62"+ "digest": "sha256:643d86abe83dd2e9db3744c77307118287fdda5088f143b81a4e8b685d893958"}diff --git a/examples/talking-film-live/svml.packages.lock b/examples/talking-film-live/svml.packages.lockindex b8e773f3..4ed91413 100644--- a/examples/talking-film-live/svml.packages.lock+++ b/examples/talking-film-live/svml.packages.lock@@ -554,7 +554,7 @@{"name": "@narratage/caption-fine","version": "0.0.0-dev",- "digest": "sha256:b3629ec8e280ac0ab5fa4e92500b7d762974e97600f8021bfc4b0a8694ae593b"+ "digest": "sha256:8094384ca1980ee72e0a5621a7ee9d62aec167521fdb536eb068eeeecee2ec9c"},{"name": "@narratage/caption-gemini",@@ -574,7 +574,7 @@{"name": "@narratage/composition","version": "0.0.0-dev",- "digest": "sha256:acc55c73eaf46558b695532a495bc078a72337ac727b97eaf412bc7147336d76"+ "digest": "sha256:c9bfd8e6d07dc38a14f622b4ce545752dee7df09c2458d4e4798dc87eb9ce997"},{"name": "@narratage/core",@@ -614,7 +614,7 @@{"name": "@narratage/hyperframes","version": "0.0.0-dev",- "digest": "sha256:cd4b8c4cfb11307e0a487fa5d065a961c1cfb701a48f6d293f98b90c6d01b5cb"+ "digest": "sha256:cbe9359d2a59fcde65e3b8d4fef43c9965b5e825b2d517fb25babad4c18ed512"},{"name": "@narratage/markup",@@ -629,7 +629,7 @@{"name": "@narratage/media-track","version": "0.0.0-dev",- "digest": "sha256:d371b1bdc8747fef280640dbc8a9cb03acde9322ad8e6f11ed02396ff8f53260"+ "digest": "sha256:073650e06f85a84f9757ab2fd1da414a51687a135257c91c7f8919d9096274d0"},{"name": "@narratage/media",@@ -739,7 +739,7 @@{"name": "@narratage/typography-track","version": "0.0.0-dev",- "digest": "sha256:d032d7f7e034803d6253c9b9082f6ddd30bff95719325f6524e87b84c6c5af7f"+ "digest": "sha256:49238db6019100687c41ba36c50db138889a4adfe5d91a0fe165629db577171a"},{"name": "@narratage/validation",@@ -783,7 +783,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:c5616408dd56ce9c903523319b2a697ff6b8af5bfe1dc66fe793a11e4629f3cf",- "closureDigest": "sha256:3cf5629f0b0b0104e5bd6342ef0ba05e3f22ba22fa62fb9e079eec90dec2fb75"+ "closureDigest": "sha256:f9e91adc137a2bd2d4bd726b99d1943aacf285453468f67864e00a70d2ab24ac"},{"specifier": "@narratage/caption-gemini",@@ -801,7 +801,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:0a988b665baf0846246e309d9faf39ffb3ef6ec455bf37f7c438eb30429ff46e",- "closureDigest": "sha256:abcc228356713b66fd2125b2bdd66679df75d8e0d39c5fd1fbacac133317c0ce"+ "closureDigest": "sha256:99ab833c7be2e6ce9591f5aebeef43cec6b327b126f2c174591af01cb56290a9"},{"specifier": "@narratage/estimate",@@ -819,7 +819,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:8e58b5630b9a68a8ce7314620f5f1c7cda973a05c179c18d61e10d68002964f0",- "closureDigest": "sha256:bcad5a1643f1b1193b79c726ce03b4ce50929652814567712d66c596599f272f"+ "closureDigest": "sha256:cca6cb3b76b6e0744ee9ad00b666076e1db5098e39a8b844d432002019d2b75b"},{"specifier": "@narratage/fonts-open",@@ -846,7 +846,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:b8b8773d03f19844cdc8d714650380145056649245e33c607f30220fff194157",- "closureDigest": "sha256:242c745bb6a51cd17dbfc9c9aa3408464b9bb14d6eab26bdebd35bcc0f958014"+ "closureDigest": "sha256:0652bed735647218d6f25a1e5dd2be5341f9a387a7fa5b5748865058bae4cd55"},{"specifier": "@narratage/media",@@ -864,7 +864,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:b7bf62142837adc7bad4f8c4b74b60ee6b4ade74140788cf4b682c140893b4af",- "closureDigest": "sha256:4a96ed320c8c32a65b6d93fb671f19562c1178b15ac89b268876e9c3c268df28"+ "closureDigest": "sha256:3ed0d2f8a7e8d0f3bbb3c4a1ee354967afe24311cd567f562ad766bdca52387c"},{"specifier": "@narratage/media-track",@@ -873,7 +873,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:b3e32ad8fd0f074d9e7cb707383e45c79f89ed1c28044f6d70294c96411cb393",- "closureDigest": "sha256:67c8618e8047675b9b315bab6c91e57d51c8f9264fe6f185a12b08c3e05db438"+ "closureDigest": "sha256:a63876d7b1b9326f77f05ca6cb180e0bbc60309cde461ca449da4717cb0e0968"},{"specifier": "@narratage/narrative",@@ -900,7 +900,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:965f293a64a8b1c7ae87e6e13986a751d4c26a2fcded9dd81fc24a7790980b45",- "closureDigest": "sha256:0c046a66947a9ef4cccc89f589b0eb9841bf668cdbdf1ef80f69eefaa34741bf"+ "closureDigest": "sha256:7f0830d7c6714b686acbd3159b4980ffe95f99100e330ac252506e8972b8186a"},{"specifier": "@narratage/run-markup",@@ -972,7 +972,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:f01f21badb0ccdd5cc62b131be05f46030bffee96042c7323a0c572786d012ef",- "closureDigest": "sha256:fb0cab2d5cc764267e5891938e2f3a4beec8706e96821e4906d290fbb7eb1be7"+ "closureDigest": "sha256:d8fbec79bf12bbac90f72e2040c9467f79c285b1e01ed4c9e7e5f36cb117e5b2"},{"specifier": "@narratage/speech-evidence",@@ -990,7 +990,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:c2d3ae7c5a676c66368c9225fd516aa6cfa7dab749123f7ecd31007628ee4666",- "closureDigest": "sha256:d0e8ca2fc3403689d8edb798787c61c934ce31a895bb779f2db9a7fdda93af00"+ "closureDigest": "sha256:38365376d684cb70f6d0e939042320c7ac309f8c4272affb0c2a91890419e45c"},{"specifier": "@narratage/svs",@@ -1026,7 +1026,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:a8193c2426018cccfc1ca9911b4d1aed7f9499b17196e14f858797b8d109bd13",- "closureDigest": "sha256:50e46db546a27733cc395b2ea48974026575890c09394ad2b7eb4da99a1e60c9"+ "closureDigest": "sha256:9ff99221ec12e2cce266def733e5a65388b5302a62b3b73004bdcdc3137d1a16"},{"specifier": "@narratage/visual-ir",@@ -1044,8 +1044,8 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:be22a14fb7f6eb437aa17b541a35320f5e26b77d7d9925702b2977609f874fe3",- "closureDigest": "sha256:a2724330f6ee6fd5ff6e804d440236852819e57c67f123b04c486a5a964027a7"+ "closureDigest": "sha256:4b2e7e4d12e50b6b8dad43c2c080dd6d5d04475a155e22cf35bb61069bba1f8a"}],- "digest": "sha256:e0c424dddda6fdb53537177367613b82b5a8e3ddc9d3f58ce84221c6251a629e"+ "digest": "sha256:5259a51ad29b38c836b2ef3edb02aded6fe5a7020da013d99fc74eb6967c6ac4"}diff --git a/examples/talking-head-aroll/svml.packages.lock b/examples/talking-head-aroll/svml.packages.lockindex c6d05715..1b55f832 100644--- a/examples/talking-head-aroll/svml.packages.lock+++ b/examples/talking-head-aroll/svml.packages.lock@@ -554,7 +554,7 @@{"name": "@narratage/caption-fine","version": "0.0.0-dev",- "digest": "sha256:b3629ec8e280ac0ab5fa4e92500b7d762974e97600f8021bfc4b0a8694ae593b"+ "digest": "sha256:8094384ca1980ee72e0a5621a7ee9d62aec167521fdb536eb068eeeecee2ec9c"},{"name": "@narratage/caption-gemini",@@ -574,7 +574,7 @@{"name": "@narratage/composition","version": "0.0.0-dev",- "digest": "sha256:acc55c73eaf46558b695532a495bc078a72337ac727b97eaf412bc7147336d76"+ "digest": "sha256:c9bfd8e6d07dc38a14f622b4ce545752dee7df09c2458d4e4798dc87eb9ce997"},{"name": "@narratage/core",@@ -614,7 +614,7 @@{"name": "@narratage/hyperframes","version": "0.0.0-dev",- "digest": "sha256:cd4b8c4cfb11307e0a487fa5d065a961c1cfb701a48f6d293f98b90c6d01b5cb"+ "digest": "sha256:cbe9359d2a59fcde65e3b8d4fef43c9965b5e825b2d517fb25babad4c18ed512"},{"name": "@narratage/markup",@@ -629,7 +629,7 @@{"name": "@narratage/media-track","version": "0.0.0-dev",- "digest": "sha256:d371b1bdc8747fef280640dbc8a9cb03acde9322ad8e6f11ed02396ff8f53260"+ "digest": "sha256:073650e06f85a84f9757ab2fd1da414a51687a135257c91c7f8919d9096274d0"},{"name": "@narratage/media",@@ -783,7 +783,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:c5616408dd56ce9c903523319b2a697ff6b8af5bfe1dc66fe793a11e4629f3cf",- "closureDigest": "sha256:3cf5629f0b0b0104e5bd6342ef0ba05e3f22ba22fa62fb9e079eec90dec2fb75"+ "closureDigest": "sha256:f9e91adc137a2bd2d4bd726b99d1943aacf285453468f67864e00a70d2ab24ac"},{"specifier": "@narratage/caption-gemini",@@ -801,7 +801,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:0a988b665baf0846246e309d9faf39ffb3ef6ec455bf37f7c438eb30429ff46e",- "closureDigest": "sha256:abcc228356713b66fd2125b2bdd66679df75d8e0d39c5fd1fbacac133317c0ce"+ "closureDigest": "sha256:99ab833c7be2e6ce9591f5aebeef43cec6b327b126f2c174591af01cb56290a9"},{"specifier": "@narratage/estimate",@@ -819,7 +819,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:8e58b5630b9a68a8ce7314620f5f1c7cda973a05c179c18d61e10d68002964f0",- "closureDigest": "sha256:bcad5a1643f1b1193b79c726ce03b4ce50929652814567712d66c596599f272f"+ "closureDigest": "sha256:cca6cb3b76b6e0744ee9ad00b666076e1db5098e39a8b844d432002019d2b75b"},{"specifier": "@narratage/fonts-open",@@ -846,7 +846,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:b8b8773d03f19844cdc8d714650380145056649245e33c607f30220fff194157",- "closureDigest": "sha256:242c745bb6a51cd17dbfc9c9aa3408464b9bb14d6eab26bdebd35bcc0f958014"+ "closureDigest": "sha256:0652bed735647218d6f25a1e5dd2be5341f9a387a7fa5b5748865058bae4cd55"},{"specifier": "@narratage/media",@@ -864,7 +864,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:b7bf62142837adc7bad4f8c4b74b60ee6b4ade74140788cf4b682c140893b4af",- "closureDigest": "sha256:4a96ed320c8c32a65b6d93fb671f19562c1178b15ac89b268876e9c3c268df28"+ "closureDigest": "sha256:3ed0d2f8a7e8d0f3bbb3c4a1ee354967afe24311cd567f562ad766bdca52387c"},{"specifier": "@narratage/narrative",@@ -891,7 +891,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:965f293a64a8b1c7ae87e6e13986a751d4c26a2fcded9dd81fc24a7790980b45",- "closureDigest": "sha256:0c046a66947a9ef4cccc89f589b0eb9841bf668cdbdf1ef80f69eefaa34741bf"+ "closureDigest": "sha256:7f0830d7c6714b686acbd3159b4980ffe95f99100e330ac252506e8972b8186a"},{"specifier": "@narratage/run-markup",@@ -972,7 +972,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:f01f21badb0ccdd5cc62b131be05f46030bffee96042c7323a0c572786d012ef",- "closureDigest": "sha256:fb0cab2d5cc764267e5891938e2f3a4beec8706e96821e4906d290fbb7eb1be7"+ "closureDigest": "sha256:d8fbec79bf12bbac90f72e2040c9467f79c285b1e01ed4c9e7e5f36cb117e5b2"},{"specifier": "@narratage/speech-evidence",@@ -990,7 +990,7 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:c2d3ae7c5a676c66368c9225fd516aa6cfa7dab749123f7ecd31007628ee4666",- "closureDigest": "sha256:d0e8ca2fc3403689d8edb798787c61c934ce31a895bb779f2db9a7fdda93af00"+ "closureDigest": "sha256:38365376d684cb70f6d0e939042320c7ac309f8c4272affb0c2a91890419e45c"},{"specifier": "@narratage/svs",@@ -1026,8 +1026,8 @@"version": "0.0.0-dev"},"facetsDigest": "sha256:be22a14fb7f6eb437aa17b541a35320f5e26b77d7d9925702b2977609f874fe3",- "closureDigest": "sha256:a2724330f6ee6fd5ff6e804d440236852819e57c67f123b04c486a5a964027a7"+ "closureDigest": "sha256:4b2e7e4d12e50b6b8dad43c2c080dd6d5d04475a155e22cf35bb61069bba1f8a"}],- "digest": "sha256:925c518aa319628c2a3dc6258b4b1ed769c95ad9f5f4708e0c338bbc4386d7f5"+ "digest": "sha256:3f47adb10eda3a03bec6e8017ab1197b7ccf6448b21a289a9cc9c0f621e18478"}diff --git a/packages/caption-fine/src/render.ts b/packages/caption-fine/src/render.tsindex a3a0779c..3749744c 100644--- a/packages/caption-fine/src/render.ts+++ b/packages/caption-fine/src/render.ts@@ -153,28 +153,75 @@ function stepOffsets(...boundaries: number[]): number[] {return boundaries.flatMap((boundary) => [boundary - 1, boundary]);}-type MotionSnapshot = { readonly opacity: number; readonly transform: string; readonly filter: string };+type MotionSnapshot = {+ readonly opacity: number;+ readonly transform: string;+ readonly filter: string;+ readonly clipPath: string;+};++function easeOut(value: number): number {+ return 1 - Math.pow(1 - value, 3);+}++function easeOutBack(value: number): number {+ const c1 = 1.3;+ const c3 = c1 + 1;+ return 1 + c3 * Math.pow(value - 1, 3) + c1 * Math.pow(value - 1, 2);+}++function easeOutBounce(value: number): number {+ let x = value;+ const n1 = 7.5625;+ const d1 = 2.75;+ if (x < 1 / d1) return n1 * x * x;+ if (x < 2 / d1) return n1 * (x -= 1.5 / d1) * x + 0.75;+ if (x < 2.5 / d1) return n1 * (x -= 2.25 / d1) * x + 0.9375;+ return n1 * (x -= 2.625 / d1) * x + 0.984375;+}++function easeOutElastic(value: number): number {+ if (value === 0 || value === 1) return value;+ return Math.pow(2, -10 * value) * Math.sin((value * 10 - 0.75) * (2 * Math.PI / 3)) + 1;+}++const neutralMotion: MotionSnapshot = { opacity: 1, transform: "none", filter: "none", clipPath: "inset(0% 0% 0% 0%)" };function motionSnapshot(kind: FineCaptionOneShotMotion, progress: number, distancePx: number): MotionSnapshot {const value = clamp(progress, 0, 1);- if (kind === "none") return { opacity: 1, transform: "none", filter: "none" };- if (kind === "fade") return { opacity: value, transform: "none", filter: "none" };- if (kind === "blur-in") {- return { opacity: value, transform: "none", filter: `blur(${compactNumber((1 - value) * 12)}px)` };- }- if (kind === "pop") {- return { opacity: value, transform: `scale(${compactNumber(0.78 + 0.22 * value)})`, filter: "none" };- }+ const eased = easeOut(value);+ const state = (opacity: number, transform = "none", filter = "none", clipPath = neutralMotion.clipPath): MotionSnapshot =>+ ({ opacity, transform, filter, clipPath });+ if (kind === "none") return neutralMotion;+ if (kind === "fade") return state(eased);+ if (kind === "blur-in") return state(eased, `scale(${compactNumber(0.96 + 0.04 * eased)})`, `blur(${compactNumber((1 - eased) * 16)}px)`);+ if (kind === "pop") return state(eased, `scale(${compactNumber(0.6 + 0.4 * easeOutBack(value))})`);+ if (kind === "scale") return state(eased, `scale(${compactNumber(0.2 + 0.8 * eased)})`);if (kind === "spring") {const settled = value >= 1 ? 1 : 1 - Math.exp(-5 * value) * Math.cos(10 * value);- return { opacity: value, transform: `scale(${compactNumber(0.72 + 0.28 * settled)})`, filter: "none" };+ return state(eased, `scale(${compactNumber(0.72 + 0.28 * settled)})`);}+ if (kind === "bounce") return state(eased, `scale(${compactNumber(easeOutBounce(value))})`);+ if (kind === "elastic") return state(eased, `scale(${compactNumber(easeOutElastic(value))})`);+ if (kind === "stamp") return state(eased, `scale(${compactNumber(1.35 - 0.35 * easeOutBack(value))})`);+ if (kind === "tilt") return state(eased, `rotate(${compactNumber((1 - eased) * -8)}deg) scale(${compactNumber(0.94 + 0.06 * eased)})`);+ if (kind === "zoom-blur") return state(eased, `scale(${compactNumber(1.18 - 0.18 * eased)})`, `blur(${compactNumber((1 - eased) * 18)}px)`);+ if (kind === "flip-x") return state(eased, `perspective(600px) rotateX(${compactNumber((1 - eased) * 88)}deg) scale(${compactNumber(0.92 + 0.08 * eased)})`);+ if (kind === "flip-y") return state(eased, `perspective(600px) rotateY(${compactNumber((1 - eased) * -88)}deg) scale(${compactNumber(0.92 + 0.08 * eased)})`);+ if (kind === "spin") return state(eased, `rotate(${compactNumber((1 - eased) * -180)}deg) scale(${compactNumber(0.55 + 0.45 * eased)})`);+ if (kind === "squash") return state(eased, `scaleX(${compactNumber(1.28 - 0.28 * easeOutBack(value))}) scaleY(${compactNumber(0.48 + 0.52 * easeOutBack(value))})`);+ if (kind === "stretch") return state(eased, `scaleX(${compactNumber(0.5 + 0.5 * easeOutBack(value))}) scaleY(${compactNumber(1.35 - 0.35 * easeOutBack(value))})`);+ const hidden = compactNumber((1 - eased) * 100);+ if (kind === "wipe-left") return state(1, "none", "none", `inset(0% 0% 0% ${hidden}%)`);+ if (kind === "wipe-right") return state(1, "none", "none", `inset(0% ${hidden}% 0% 0%)`);+ if (kind === "wipe-up") return state(1, "none", "none", `inset(0% 0% ${hidden}% 0%)`);+ if (kind === "wipe-down") return state(1, "none", "none", `inset(${hidden}% 0% 0% 0%)`);const remaining = compactNumber((1 - value) * distancePx);const transform = kind === "slide-left" ? `translateX(-${remaining}px)`: kind === "slide-right" ? `translateX(${remaining}px)`: kind === "slide-up" ? `translateY(-${remaining}px)`: `translateY(${remaining}px)`;- return { opacity: value, transform, filter: "none" };+ return state(eased, transform);}function snapshotStyle(snapshot: MotionSnapshot): VisualStyleDeclaration[] {@@ -182,12 +229,13 @@ function snapshotStyle(snapshot: MotionSnapshot): VisualStyleDeclaration[] {{ name: "opacity", value: snapshot.opacity },{ name: "transform", value: snapshot.transform },{ name: "filter", value: snapshot.filter },+ { name: "clip-path", value: snapshot.clipPath },];}function transitionOffsets(start: number, frames: number, kind: FineCaptionOneShotMotion): number[] {if (frames === 0) return stepOffsets(start);- const samples = kind === "spring" ? Math.min(frames, 8) : Math.min(frames, 4);+ const samples = ["spring", "bounce", "elastic"].includes(kind) ? Math.min(frames, 12) : Math.min(frames, 4);return Array.from({ length: samples + 1 }, (_, index) => start + Math.round(frames * index / samples));}@@ -209,20 +257,32 @@ function cueAnimation(parameters: FineCaptionParameters, durationFrames: number)});}-function atomEntryAnimation(+function atomLifecycleAnimation(parameters: FineCaptionParameters,startFrame: number,+ endFrame: number,durationFrames: number,): VisualAnimation | undefined {const shouldWait = parameters.motion.atomReveal === "on-start" || parameters.motion.atomEnter !== "none";- if (!shouldWait) return undefined;+ if (!shouldWait && parameters.motion.atomExit === "none") return undefined;const enterFrames = parameters.motion.atomEnter === "none" ? 0- : Math.min(parameters.motion.atomEnterFrames, Math.max(0, durationFrames - startFrame));- return animationFrom(durationFrames, transitionOffsets(startFrame, enterFrames, parameters.motion.atomEnter), (frame) => {- if (frame < startFrame) return [{ name: "opacity", value: 0 }];- if (parameters.motion.atomEnter === "none") return [{ name: "opacity", value: 1 }];- const progress = enterFrames === 0 ? 1 : (frame - startFrame) / enterFrames;- return snapshotStyle(motionSnapshot(parameters.motion.atomEnter, progress, parameters.motion.slideDistancePx));+ : Math.min(parameters.motion.atomEnterFrames, Math.max(0, endFrame - startFrame));+ const exitFrames = parameters.motion.atomExit === "none" ? 0+ : Math.min(parameters.motion.atomExitFrames, Math.max(0, endFrame - startFrame - enterFrames));+ const offsets = [+ ...transitionOffsets(startFrame, enterFrames, parameters.motion.atomEnter),+ ...transitionOffsets(endFrame - exitFrames, exitFrames, parameters.motion.atomExit),+ ...stepOffsets(endFrame),+ ];+ return animationFrom(durationFrames, offsets, (frame) => {+ if (frame < startFrame) return shouldWait ? [{ name: "opacity", value: 0 }] : snapshotStyle(neutralMotion);+ if (frame >= endFrame && parameters.motion.atomExit !== "none") {+ return snapshotStyle(motionSnapshot(parameters.motion.atomExit, 0, parameters.motion.slideDistancePx));+ }+ const enterProgress = enterFrames === 0 ? 1 : clamp((frame - startFrame) / enterFrames, 0, 1);+ const exitProgress = exitFrames === 0 ? 1 : clamp((endFrame - frame) / exitFrames, 0, 1);+ if (enterProgress < 1) return snapshotStyle(motionSnapshot(parameters.motion.atomEnter, enterProgress, parameters.motion.slideDistancePx));+ return snapshotStyle(motionSnapshot(parameters.motion.atomExit, exitProgress, parameters.motion.slideDistancePx));});}@@ -306,13 +366,16 @@ function activeResponseAnimation(}const frames = Math.min(parameters.motion.activeResponseFrames, Math.max(1, endFrame - startFrame));return animationFrom(durationFrames, transitionOffsets(startFrame, frames, response), (frame) => {- if (frame < startFrame || frame > startFrame + frames) return [{ name: "transform", value: "scale(1)" }];+ if (frame < startFrame || frame > startFrame + frames) return snapshotStyle(neutralMotion);const progress = clamp((frame - startFrame) / frames, 0, 1);- const amplitude = parameters.motion.activeScale - 1;- const responseScale = response === "pop"- ? 1 + amplitude * Math.sin(Math.PI * progress)- : 1 + amplitude * Math.exp(-4 * progress) * Math.sin(12 * progress);- return [{ name: "transform", value: `scale(${compactNumber(responseScale)})` }];+ if (response === "pop" || response === "spring") {+ const amplitude = parameters.motion.activeScale - 1;+ const responseScale = response === "pop"+ ? 1 + amplitude * Math.sin(Math.PI * progress)+ : 1 + amplitude * Math.exp(-4 * progress) * Math.sin(12 * progress);+ return [{ name: "transform", value: `scale(${compactNumber(responseScale)})` }];+ }+ return snapshotStyle(motionSnapshot(response, progress, parameters.motion.slideDistancePx));});}@@ -331,7 +394,8 @@ function loopAnimation(const active = frame >= start && (frame < end || (end === durationFrames && frame === durationFrames));if (!active) return parameters.motion.loop === "glow-pulse"? [{ name: "filter", value: "none" }]- : [{ name: "transform", value: "none" }];+ : parameters.motion.loop === "flicker" ? [{ name: "opacity", value: 1 }]+ : [{ name: "transform", value: "none" }];const phase = 2 * Math.PI * ((frame - start) % period) / period;if (parameters.motion.loop === "shake") {return [{ name: "transform", value: `translateX(${compactNumber(Math.sin(phase * 2) * 3 * parameters.motion.loopIntensity)}px)` }];@@ -339,6 +403,18 @@ function loopAnimation(if (parameters.motion.loop === "wobble") {return [{ name: "transform", value: `rotate(${compactNumber(Math.sin(phase) * 2.5 * parameters.motion.loopIntensity)}deg)` }];}+ if (parameters.motion.loop === "breathe") {+ return [{ name: "transform", value: `scale(${compactNumber(1 + Math.sin(phase) * 0.035 * parameters.motion.loopIntensity)})` }];+ }+ if (parameters.motion.loop === "float") {+ return [{ name: "transform", value: `translateY(${compactNumber(Math.sin(phase) * 3.2 * parameters.motion.loopIntensity)}px)` }];+ }+ if (parameters.motion.loop === "pulse") {+ return [{ name: "transform", value: `scale(${compactNumber(1 + (Math.sin(phase) + 1) * 0.0375 * parameters.motion.loopIntensity)})` }];+ }+ if (parameters.motion.loop === "flicker") {+ return [{ name: "opacity", value: clamp(1 - (Math.sin(phase * 5) + 1) * 0.11 * parameters.motion.loopIntensity, 0.15, 1) }];+ }const strength = (0.35 + 0.65 * (Math.sin(phase) + 1) / 2) * parameters.motion.loopIntensity;const paint = activeWindow === undefined ? parameters.basePaint : parameters.activePaint;const color = paint.glow.opacity > 0 ? paint.glow.color : paint.fill;@@ -361,8 +437,8 @@ function activeBoxAnimation(const exitFrames = box.exit === "none" ? 0 : Math.min(box.transitionFrames, Math.max(0, logicalEnd - startFrame));const offsets = [...stepOffsets(startFrame, logicalEnd),- ...transitionOffsets(startFrame, enterFrames, box.enter === "pop" ? "pop" : box.enter),- ...transitionOffsets(logicalEnd - exitFrames, exitFrames, box.exit === "pop" ? "pop" : box.exit),+ ...transitionOffsets(startFrame, enterFrames, box.enter),+ ...transitionOffsets(logicalEnd - exitFrames, exitFrames, box.exit),];return animationFrom(durationFrames, offsets, (frame) => {if (frame < startFrame || frame > logicalEnd || (frame === logicalEnd && logicalEnd !== durationFrames)) {@@ -370,12 +446,8 @@ function activeBoxAnimation(}const enterProgress = enterFrames === 0 ? 1 : clamp((frame - startFrame) / enterFrames, 0, 1);const exitProgress = exitFrames === 0 ? 1 : clamp((logicalEnd - frame) / exitFrames, 0, 1);- const progress = Math.min(enterProgress, exitProgress);- const isPop = (enterProgress < 1 ? box.enter : box.exit) === "pop";- return [- { name: "opacity", value: (enterProgress < 1 ? box.enter : box.exit) === "none" ? 1 : progress },- { name: "transform", value: isPop ? `scale(${compactNumber(0.82 + 0.18 * progress)})` : "scale(1)" },- ];+ const kind = enterProgress < 1 ? box.enter : box.exit;+ return snapshotStyle(motionSnapshot(kind, Math.min(enterProgress, exitProgress), parameters.motion.slideDistancePx));}) ?? { keyframes: [{ atFrame: 0, style: [{ name: "opacity", value: 1 }] },{ atFrame: durationFrames, style: [{ name: "opacity", value: 1 }] },@@ -518,7 +590,7 @@ function cueElements(const typewriterId = `${atomId}-typewriter`;const loopId = `${atomId}-loop`;const responseId = `${atomId}-response`;- const entryAnimation = atomEntryAnimation(parameters, timing.start, durationFrames);+ const entryAnimation = atomLifecycleAnimation(parameters, timing.start, timing.end, durationFrames);const writerAnimation = typewriterAnimation(atomText, parameters, timing.start, timing.end, durationFrames);const atomLoop = parameters.motion.loopTarget === "active-atom"? loopAnimation(parameters, durationFrames, timing) : undefined;diff --git a/packages/caption-fine/src/style.ts b/packages/caption-fine/src/style.tsindex 2df14dc3..e72c4d20 100644--- a/packages/caption-fine/src/style.ts+++ b/packages/caption-fine/src/style.ts@@ -23,7 +23,7 @@ const OPTIONAL_PROPERTIES = ["active-response", "active-response-frames", "active-scale", "active-shadow-blur", "active-shadow-color", "active-shadow-opacity","active-shadow-x", "active-shadow-y", "active-stroke-color", "active-stroke-width", "active-underline","active-underline-color", "active-underline-offset", "active-underline-thickness", "anchor-x", "anchor-y",- "atom-enter", "atom-enter-frames", "atom-reveal", "border-color", "border-width", "cue-enter",+ "atom-enter", "atom-enter-frames", "atom-exit", "atom-exit-frames", "atom-reveal", "border-color", "border-width", "cue-enter","cue-enter-frames", "cue-exit", "cue-exit-frames", "direction", "font-style", "glow-blur", "glow-color","glow-opacity", "gradient-angle", "gradient-from", "gradient-to", "karaoke", "karaoke-transition","letter-spacing", "long-shadow-angle", "long-shadow-color", "long-shadow-distance", "long-shadow-opacity",@@ -193,7 +193,9 @@ export function fineCaptionParameters(const fontSizePx = number(recipe, "size");const basePaint = glyphPaint(recipe, "");const oneShotMotions = [- "none", "fade", "pop", "spring", "slide-left", "slide-right", "slide-up", "slide-down", "blur-in",+ "none", "fade", "pop", "scale", "spring", "bounce", "elastic", "stamp", "tilt", "zoom-blur",+ "flip-x", "flip-y", "spin", "squash", "stretch", "slide-left", "slide-right", "slide-up", "slide-down",+ "blur-in", "wipe-left", "wipe-right", "wipe-up", "wipe-down",] as const;const parameters: FineCaptionParameters = {contract: "svml.caption-fine-parameters@1",@@ -255,8 +257,8 @@ export function fineCaptionParameters(paddingXPx: activeBoxPadding.x,paddingYPx: activeBoxPadding.y,radiusPx: number(recipe, "active-box-radius", 8),- enter: choice(recipe, "active-box-enter", ["none", "fade", "pop"] as const, "none"),- exit: choice(recipe, "active-box-exit", ["none", "fade", "pop"] as const, "none"),+ enter: choice(recipe, "active-box-enter", oneShotMotions, "none"),+ exit: choice(recipe, "active-box-exit", oneShotMotions, "none"),transitionFrames: integer(recipe, "active-box-transition-frames", 0),},motion: {@@ -266,12 +268,14 @@ export function fineCaptionParameters(cueExitFrames: integer(recipe, "cue-exit-frames", 0),atomEnter: choice(recipe, "atom-enter", oneShotMotions, "none"),atomEnterFrames: integer(recipe, "atom-enter-frames", 0),+ atomExit: choice(recipe, "atom-exit", oneShotMotions, "none"),+ atomExitFrames: integer(recipe, "atom-exit-frames", 0),atomReveal: choice(recipe, "atom-reveal", ["all", "on-start", "typewriter"] as const, "all"),- activeResponse: choice(recipe, "active-response", ["none", "scale", "pop", "spring"] as const, "none"),+ activeResponse: choice(recipe, "active-response", oneShotMotions, "none"),activeResponseFrames: integer(recipe, "active-response-frames", 6),activeScale: number(recipe, "active-scale", 1.08),slideDistancePx: number(recipe, "slide-distance", 24),- loop: choice(recipe, "loop", ["none", "shake", "wobble", "glow-pulse"] as const, "none"),+ loop: choice(recipe, "loop", ["none", "shake", "wobble", "glow-pulse", "breathe", "float", "pulse", "flicker"] as const, "none"),loopTarget: choice(recipe, "loop-target", ["cue", "active-atom"] as const, "cue"),loopPeriodFrames: integer(recipe, "loop-period-frames", 12),loopIntensity: number(recipe, "loop-intensity", 1),@@ -293,14 +297,16 @@ export function assertFineCaptionParameters(value: FineCaptionParameters): voidvalue.underline.thicknessPx, value.underline.offsetPx, value.activeUnderline.thicknessPx,value.activeUnderline.offsetPx, value.activeBox.borderWidthPx, value.activeBox.paddingXPx,value.activeBox.paddingYPx, value.activeBox.radiusPx, value.activeBox.transitionFrames,- value.motion.cueEnterFrames, value.motion.cueExitFrames, value.motion.atomEnterFrames, value.motion.activeResponseFrames,+ value.motion.cueEnterFrames, value.motion.cueExitFrames, value.motion.atomEnterFrames, value.motion.atomExitFrames,+ value.motion.activeResponseFrames,value.motion.slideDistancePx, value.motion.loopPeriodFrames, value.motion.loopIntensity,];if (nonNegative.some((item) => !Number.isFinite(item) || item < 0)|| value.placement.x > 1 || value.placement.y > 1 || value.placement.width <= 0 || value.placement.width > 1|| value.typography.fontSizePx <= 0 || value.layout.lineHeight <= 0|| !Number.isSafeInteger(value.motion.cueEnterFrames) || !Number.isSafeInteger(value.motion.cueExitFrames)- || !Number.isSafeInteger(value.motion.atomEnterFrames) || !Number.isSafeInteger(value.motion.loopPeriodFrames)+ || !Number.isSafeInteger(value.motion.atomEnterFrames) || !Number.isSafeInteger(value.motion.atomExitFrames)+ || !Number.isSafeInteger(value.motion.loopPeriodFrames)|| !Number.isSafeInteger(value.motion.activeResponseFrames)|| !Number.isSafeInteger(value.activeBox.transitionFrames) || value.motion.loopPeriodFrames <= 0|| value.motion.activeScale <= 0diff --git a/packages/caption-fine/src/types.ts b/packages/caption-fine/src/types.tsindex 261cb45b..8453f987 100644--- a/packages/caption-fine/src/types.ts+++ b/packages/caption-fine/src/types.ts@@ -52,8 +52,8 @@ export type FineCaptionBoxPaint = {readonly paddingXPx: number;readonly paddingYPx: number;readonly radiusPx: number;- readonly enter: "none" | "fade" | "pop";- readonly exit: "none" | "fade" | "pop";+ readonly enter: FineCaptionOneShotMotion;+ readonly exit: FineCaptionOneShotMotion;readonly transitionFrames: number;};@@ -61,12 +61,27 @@ export type FineCaptionOneShotMotion =| "none"| "fade"| "pop"+ | "scale"| "spring"+ | "bounce"+ | "elastic"+ | "stamp"+ | "tilt"+ | "zoom-blur"+ | "flip-x"+ | "flip-y"+ | "spin"+ | "squash"+ | "stretch"| "slide-left"| "slide-right"| "slide-up"| "slide-down"- | "blur-in";+ | "blur-in"+ | "wipe-left"+ | "wipe-right"+ | "wipe-up"+ | "wipe-down";export type FineCaptionParameters = {readonly contract: "svml.caption-fine-parameters@1";@@ -117,12 +132,14 @@ export type FineCaptionParameters = {readonly cueExitFrames: number;readonly atomEnter: FineCaptionOneShotMotion;readonly atomEnterFrames: number;+ readonly atomExit: FineCaptionOneShotMotion;+ readonly atomExitFrames: number;readonly atomReveal: "all" | "on-start" | "typewriter";- readonly activeResponse: "none" | "scale" | "pop" | "spring";+ readonly activeResponse: FineCaptionOneShotMotion;readonly activeResponseFrames: number;readonly activeScale: number;readonly slideDistancePx: number;- readonly loop: "none" | "shake" | "wobble" | "glow-pulse";+ readonly loop: "none" | "shake" | "wobble" | "glow-pulse" | "breathe" | "float" | "pulse" | "flicker";readonly loopTarget: "cue" | "active-atom";readonly loopPeriodFrames: number;readonly loopIntensity: number;diff --git a/packages/caption-fine/test/caption-fine.test.ts b/packages/caption-fine/test/caption-fine.test.tsindex 9e47e693..0bba0342 100644--- a/packages/caption-fine/test/caption-fine.test.ts+++ b/packages/caption-fine/test/caption-fine.test.ts@@ -271,7 +271,7 @@ test("Fine resolves the complete orthogonal Paint, anchor, karaoke and motion suassert.deepEqual(parameters.karaoke, { mode: "trail", transition: "wipe" });assert.deepEqual(parameters.motion, {cueEnter: "spring", cueExit: "blur-in", cueEnterFrames: 6, cueExitFrames: 6,- atomEnter: "slide-up", atomEnterFrames: 5, atomReveal: "typewriter",+ atomEnter: "slide-up", atomEnterFrames: 5, atomExit: "none", atomExitFrames: 0, atomReveal: "typewriter",activeResponse: "spring", activeResponseFrames: 7, activeScale: 1.12, slideDistancePx: 20,loop: "wobble", loopTarget: "active-atom", loopPeriodFrames: 14, loopIntensity: 0.8,});@@ -559,12 +559,14 @@ test("every declared one-shot and loop motion lowers through the same wrapper voreturn renderFineCaption(projection, program, display, space).presents[0]!.elements;};for (const kind of [- "fade", "pop", "spring", "slide-left", "slide-right", "slide-up", "slide-down", "blur-in",+ "fade", "pop", "scale", "spring", "bounce", "elastic", "stamp", "tilt", "zoom-blur",+ "flip-x", "flip-y", "spin", "squash", "stretch", "slide-left", "slide-right", "slide-up", "slide-down",+ "blur-in", "wipe-left", "wipe-right", "wipe-up", "wipe-down",] as const) {const elements = render(`enter-${kind}`, { "cue-enter": kind, "cue-enter-frames": 6 });assert.ok(elements.find((element) => element.id === "cue-motion")?.animation, `${kind} emitted no Cue animation`);}- for (const kind of ["shake", "wobble", "glow-pulse"] as const) {+ for (const kind of ["shake", "wobble", "glow-pulse", "breathe", "float", "pulse", "flicker"] as const) {const elements = render(`loop-${kind}`, { loop: kind, "loop-target": "cue", "loop-period-frames": 8 });assert.ok(elements.find((element) => element.id === "cue-loop")?.animation, `${kind} emitted no loop animation`);}@@ -575,4 +577,7 @@ test("every declared one-shot and loop motion lowers through the same wrapper voassert.ok(elements.find((element) => element.id === "atom-1-response")?.animation,`${kind} emitted no active response`);}+ const exiting = render("atom-exit", { "atom-exit": "wipe-left", "atom-exit-frames": 4 });+ assert.ok(exiting.find((element) => element.id === "atom-1-entry")?.animation,+ "Atom exit emitted no lifecycle animation");});diff --git a/packages/comment-sticker/src/program.ts b/packages/comment-sticker/src/program.tsindex 94a07068..7805f2cb 100644--- a/packages/comment-sticker/src/program.ts+++ b/packages/comment-sticker/src/program.ts@@ -337,64 +337,43 @@ function transform(y: number, rotation: number, scale: number): string {return `translate3d(0px,${px(y)},0) rotate(${Number(rotation.toFixed(6))}deg) scale(${Number(scale.toFixed(6))})`;}+function motionProgress(value: number, easing: "linear" | "ease-in" | "ease-out" | "ease-in-out"): number {+ const progress = Math.max(0, Math.min(1, value));+ if (easing === "linear") return progress;+ if (easing === "ease-in") return progress * progress * progress;+ if (easing === "ease-out") return 1 - Math.pow(1 - progress, 3);+ return progress < 0.5 ? 4 * progress * progress * progress : 1 - Math.pow(-2 * progress + 2, 3) / 2;+}+function motionAnimation(style: CommentStickerStyle, duration: number): VisualAnimation | undefined {const enterDuration = style.motion.enter.kind === "none" ? 0 : style.motion.enter.durationFrames;const exitDuration = style.motion.exit.kind === "none" ? 0 : style.motion.exit.durationFrames;- assert(enterDuration + exitDuration <= duration, "Comment Sticker enter and exit motion exceed its projected window.");if (enterDuration === 0 && exitDuration === 0 && style.motion.hold.kind === "none") return undefined;- const frames = new Map<number, { easing?: "linear" | "ease-in" | "ease-out" | "ease-in-out"; opacity: number; y: number; rotation: number; scale: number }>();const baseRotation = style.card.rotationDeg;- const put = (atFrame: number, value: { easing?: "linear" | "ease-in" | "ease-out" | "ease-in-out"; opacity: number; y: number; rotation: number; scale: number }) => {- frames.set(atFrame, value);- };- if (enterDuration > 0) {- const enter = style.motion.enter;- put(0, {- opacity: enter.kind === "fade" ? 0 : 0,- y: enter.kind === "slide-pop" ? enter.offsetYPx : 0,- rotation: enter.kind === "fade" ? baseRotation : baseRotation + enter.rotationDeltaDeg,- scale: enter.kind === "fade" ? 1 : enter.startScale,- });- put(enterDuration, { easing: enter.easing, opacity: 1, y: 0, rotation: baseRotation, scale: 1 });- } else {- put(0, { opacity: 1, y: 0, rotation: baseRotation, scale: 1 });- }const exitStart = duration - exitDuration;- if (style.motion.hold.kind === "float" && exitStart > enterDuration) {- const quarter = Math.max(1, Math.round(style.motion.hold.periodFrames / 4));- for (let frame = enterDuration + quarter; frame < exitStart; frame += quarter) {- const phase = (frame - enterDuration) / style.motion.hold.periodFrames * Math.PI * 2;- put(frame, {- easing: "ease-in-out",- opacity: 1,- y: Math.sin(phase) * style.motion.hold.amplitudeYPx,- rotation: baseRotation + Math.sin(phase) * style.motion.hold.rotationAmplitudeDeg,- scale: 1,- });- }- put(exitStart, { easing: "ease-in-out", opacity: 1, y: 0, rotation: baseRotation, scale: 1 });- }- if (exitDuration > 0) {- put(exitStart, { opacity: 1, y: 0, rotation: baseRotation, scale: 1 });- put(duration, {- easing: style.motion.exit.easing,- opacity: 0,- y: style.motion.exit.kind === "fade-up" ? style.motion.exit.offsetYPx : 0,- rotation: baseRotation,- scale: 1,- });- } else if (!frames.has(duration)) {- put(duration, { opacity: 1, y: 0, rotation: baseRotation, scale: 1 });- }return {- keyframes: [...frames].sort(([left], [right]) => left - right).map(([atFrame, value]) => ({- atFrame,- ...(value.easing === undefined ? {} : { easing: value.easing }),- style: [- { name: "opacity", value: value.opacity },- { name: "transform", value: transform(value.y, value.rotation, value.scale) },- ],- })),+ keyframes: Array.from({ length: duration + 1 }, (_, atFrame) => {+ const enter = style.motion.enter;+ const enterProgress = enterDuration === 0 ? 1 : motionProgress(atFrame / enterDuration, enter.easing);+ const exit = style.motion.exit;+ const exitProgress = exitDuration === 0 ? 0 : motionProgress((atFrame - exitStart) / exitDuration, exit.easing);+ const holdActive = style.motion.hold.kind === "float" && atFrame >= enterDuration && atFrame <= exitStart;+ const holdPhase = holdActive ? (atFrame - enterDuration) / style.motion.hold.periodFrames * Math.PI * 2 : 0;+ const holdY = holdActive ? Math.sin(holdPhase) * style.motion.hold.amplitudeYPx : 0;+ const holdRotation = holdActive ? Math.sin(holdPhase) * style.motion.hold.rotationAmplitudeDeg : 0;+ const enterY = enter.kind === "slide-pop" ? enter.offsetYPx * (1 - enterProgress) : 0;+ const enterRotation = enter.kind === "fade" || enter.kind === "none" ? 0 : enter.rotationDeltaDeg * (1 - enterProgress);+ const enterScale = enter.kind === "fade" || enter.kind === "none" ? 1 : enter.startScale + ((1 - enter.startScale) * enterProgress);+ const exitY = exit.kind === "fade-up" ? exit.offsetYPx * exitProgress : 0;+ return {+ atFrame,+ easing: "linear" as const,+ style: [+ { name: "opacity", value: enterProgress * (1 - exitProgress) },+ { name: "transform", value: transform(enterY + holdY + exitY, baseRotation + enterRotation + holdRotation, enterScale) },+ ],+ };+ }),};}diff --git a/packages/comment-sticker/test/comment-sticker.test.ts b/packages/comment-sticker/test/comment-sticker.test.tsindex 6e57308c..fd9d0fe6 100644--- a/packages/comment-sticker/test/comment-sticker.test.ts+++ b/packages/comment-sticker/test/comment-sticker.test.ts@@ -104,6 +104,29 @@ test("SVS controls appearance and local motion but cannot smuggle geometry", ()assert.throws(() => decodeCommentStickerStyle({ ...recipe, properties: { x: 0.2 } }, fonts, "bad"), /does not accept x/u);});+test("short Sticker windows compose overlapping enter and exit motion instead of rejecting them", () => {+ const compressed = decodeCommentStickerStyle({+ ...recipe,+ properties: {+ enter: "slide-pop",+ "enter-frames": 70,+ exit: "fade-up",+ "exit-frames": 60,+ hold: "none",+ },+ }, fonts, "compressed");+ const set = appendProgramCommentSticker(+ createCommentStickerSet(), header, frame, compressed, space, item("compressed"), content(),+ );+ const rendered = renderCommentSticker(canvas, space, finalizeCommentSticker(set, header));+ const animation = rendered.presents[0]?.elements.find((element) => element.animation !== undefined)?.animation;+ assert.ok(animation);+ const overlap = animation.keyframes.find((keyframe) => keyframe.atFrame === 45)!;+ const opacity = overlap.style.find((declaration) => declaration.name === "opacity")?.value;+ assert.equal(typeof opacity, "number");+ assert.ok((opacity as number) > 0 && (opacity as number) < 1);+});+function parsed(source: string) {return parseStructuredElement({ name: "fixture.svml", text: source }, 0).element;}diff --git a/packages/composition/src/track.ts b/packages/composition/src/track.tsindex 33ac423f..adc10e42 100644--- a/packages/composition/src/track.ts+++ b/packages/composition/src/track.ts@@ -819,7 +819,7 @@ function assertTextFlow(flow: VisualTextFlow, label: string): void {function assertTextSequences(sequences: readonly VisualTextSequenceAnimation[],- durationFrames: number,+ _durationFrames: number,label: string,): void {const ids = new Set<string>();@@ -834,7 +834,7 @@ function assertTextSequences(}if (!Number.isSafeInteger(sequence.range.start) || !Number.isSafeInteger(sequence.range.endExclusive)|| sequence.range.start < 0 || sequence.range.endExclusive <= sequence.range.start- || !Number.isSafeInteger(sequence.startFrame) || sequence.startFrame < 0 || sequence.startFrame > durationFrames+ || !Number.isSafeInteger(sequence.startFrame) || sequence.startFrame < 0|| !Number.isSafeInteger(sequence.unitDurationFrames) || sequence.unitDurationFrames <= 0|| !Number.isSafeInteger(sequence.staggerFrames) || sequence.staggerFrames < 0|| !Number.isSafeInteger(sequence.cycles) || sequence.cycles <= 0@@ -844,10 +844,6 @@ function assertTextSequences(if ((sequence.order === "random") !== (sequence.seed !== undefined)) {throw new Error(`${item} random order requires one explicit seed, and other orders forbid it.`);}- const lastUnitEnd = sequence.startFrame- + (sequence.range.endExclusive - sequence.range.start - 1) * sequence.staggerFrames- + sequence.unitDurationFrames * sequence.cycles;- if (lastUnitEnd > durationFrames) throw new Error(`${item} animation exceeds its Present span.`);if (sequence.keyframes.length < 2 || sequence.keyframes[0]?.atProgress !== 0 || sequence.keyframes.at(-1)?.atProgress !== 1) {throw new Error(`${item} keyframes must cover progress [0, 1].`);}@@ -877,7 +873,7 @@ function assertPathCommands(path: readonly VisualVectorPathCommand[], label: str}}-function assertAnimation(animation: VisualAnimation | undefined, durationFrames: number, label: string): void {+function assertAnimation(animation: VisualAnimation | undefined, _durationFrames: number, label: string): void {if (animation === undefined) return;if (animation.keyframes.length < 2) throw new Error(`${label} animation must contain at least two keyframes.`);let previous = -1;@@ -885,7 +881,6 @@ function assertAnimation(animation: VisualAnimation | undefined, durationFrames:if (!Number.isSafeInteger(keyframe.atFrame)|| keyframe.atFrame < 0- || keyframe.atFrame > durationFrames|| keyframe.atFrame <= previous) {throw new Error(`${label} animation keyframe ${index + 1} has an invalid frame offset.`);@@ -905,9 +900,6 @@ function assertAnimation(animation: VisualAnimation | undefined, durationFrames:}previous = keyframe.atFrame;}- if (animation.keyframes[0]!.atFrame !== 0 || animation.keyframes.at(-1)!.atFrame !== durationFrames) {- throw new Error(`${label} animation must cover the complete Present span.`);- }}function assertPresent(present: VisualPresent, programSpace: ProgramSpace | undefined, trackId: string): void {@@ -997,10 +989,7 @@ function assertPresent(present: VisualPresent, programSpace: ProgramSpace | undenonNegative(element.endMarginPx, `${label}.endMarginPx`);if (element.marginAnimation !== undefined) {const frames = element.marginAnimation.keyframes;- if (frames.length < 2 || frames[0]?.atFrame !== 0- || frames.at(-1)?.atFrame !== present.span.endFrameExclusive - present.span.startFrame) {- throw new Error(`${label}.marginAnimation must cover the complete Present span.`);- }+ if (frames.length < 2) throw new Error(`${label}.marginAnimation requires two keyframes.`);let previous = -1;for (const [index, keyframe] of frames.entries()) {if (!Number.isSafeInteger(keyframe.atFrame) || keyframe.atFrame <= previous) {diff --git a/packages/composition/test/track.test.ts b/packages/composition/test/track.test.tsindex 40865299..017cabb6 100644--- a/packages/composition/test/track.test.ts+++ b/packages/composition/test/track.test.ts@@ -294,7 +294,7 @@ test("one authoring Track may contribute independently stacked Presents", () =>assert.deepEqual(interleaved.presents.map((present) => present.stacking.order), [30, 80]);});-test("Visual Present animations are frame-exact and cannot animate cross-Track styles", () => {+test("Visual Present animations may finish before or after their visibility window without changing Track isolation", () => {const { programSpace, visual } = fixture();const present = visual.presents[0]!;const root = present.elements[0]!;@@ -307,7 +307,7 @@ test("Visual Present animations are frame-exact and cannot animate cross-Track sanimation: {keyframes: [{ atFrame: 0, style: [{ name: "opacity", value: 0 }] },- { atFrame: 60, easing: "ease-out", style: [{ name: "opacity", value: 1 }] },+ { atFrame: 10, easing: "ease-out", style: [{ name: "opacity", value: 1 }] },],},}],@@ -319,6 +319,27 @@ test("Visual Present animations are frame-exact and cannot animate cross-Track scanvas: { width: 1080, height: 1920, clearColor: "#000000" },tracks: [animated],}), programSpace));+ const clipped = sealVisualTrack({+ ...visual,+ presents: [{+ ...present,+ elements: [{+ ...root,+ animation: {+ keyframes: [+ { atFrame: 0, style: [{ name: "opacity", value: 0 }] },+ { atFrame: 90, easing: "ease-out", style: [{ name: "opacity", value: 1 }] },+ ],+ },+ }],+ }],+ });+ assert.doesNotThrow(() => assertCompositionIdentity(sealComposition({+ contract: "svml.composition@1",+ id: "clipped-animation",+ canvas: { width: 1080, height: 1920, clearColor: "#000000" },+ tracks: [clipped],+ }), programSpace));const invasive = sealVisualTrack({...visual,presents: [{diff --git a/packages/hyperframes/src/document.ts b/packages/hyperframes/src/document.tsindex 0ee9a212..30f4fa6e 100644--- a/packages/hyperframes/src/document.ts+++ b/packages/hyperframes/src/document.ts@@ -6,6 +6,7 @@ import { assertCompositionIdentity } from "@narratage/composition";import type {Composition,Track,+ VisualAnimation,VisualAttribute,VisualElement,VisualPresent,@@ -239,12 +240,16 @@ function renderElement(const animationProperties = element.animation === undefined? []: [...new Set(element.animation.keyframes.flatMap((keyframe) => keyframe.style.map((declaration) => declaration.name)))].sort();+ const animationDurationFrames = element.animation === undefined+ ? context.presentDurationFrames+ : Math.max(context.presentDurationFrames, element.animation.keyframes.at(-1)?.atFrame ?? 0);+ const animationDuration = frameSeconds(animationDurationFrames, context.programNumerator, context.programDenominator);const inlineStyle = [css(element.style),...exactFontStyle(element),...(animationName === undefined ? [] : [`animation-name:${animationName}`,- `animation-duration:${context.presentDuration}s`,+ `animation-duration:${animationDuration}s`,"animation-fill-mode:both",// An independently launched render worker may begin at any frame. Keep// CSS animations inert from first paint so HyperFrames' exact seek is@@ -257,7 +262,7 @@ function renderElement(const commonAttributes = `id="${id}" data-svml-element-id="${escapeHtml(element.id)}"${attributes(element.attributes)}`;const animationAttributes = animationName === undefined? ""- : ` data-svml-frame-animation data-svml-animation-start-frame="${context.presentStartFrame}" data-svml-animation-duration-frames="${context.presentDurationFrames}" data-svml-animation-properties="${animationProperties.join(",")}"`;+ : ` data-svml-frame-animation data-svml-animation-start-frame="${context.presentStartFrame}" data-svml-animation-duration-frames="${animationDurationFrames}" data-svml-animation-sample-frames="${context.presentDurationFrames}" data-svml-animation-properties="${animationProperties.join(",")}"`;const common = `${commonAttributes}${animationAttributes} style="${escapeHtml(inlineStyle)}"`;if (element.kind === "mask") {const direct = children.get(element.id) ?? [];@@ -428,20 +433,18 @@ function renderVisualPresent(}function renderAnimationRules(track: VisualTrack, present: VisualPresent): string[] {- const durationFrames = present.span.endFrameExclusive - present.span.startFrame;+ const presentDurationFrames = present.span.endFrameExclusive - present.span.startFrame;return present.elements.flatMap((element) => {- if (element.kind === "text-flow" || element.kind === "path-text") {- if (element.animation === undefined) return [];- const name = stableDomId(["animation", track.id, present.id, element.id]);- const frames = element.animation.keyframes.map((keyframe) => {- const easing = keyframe.easing === undefined ? "" : `;animation-timing-function:${keyframe.easing}`;- return `${percentage(keyframe.atFrame, durationFrames)}{${css(keyframe.style)}${easing}}`;- }).join("");- return [`@keyframes ${name}{${frames}}`];- }if (element.animation === undefined) return [];+ const durationFrames = Math.max(presentDurationFrames, element.animation.keyframes.at(-1)?.atFrame ?? 0);const name = stableDomId(["animation", track.id, present.id, element.id]);- const frames = element.animation.keyframes.map((keyframe) => {+ const keyframes: VisualAnimation["keyframes"] = element.animation.keyframes.at(-1)?.atFrame === durationFrames+ ? element.animation.keyframes+ : [...element.animation.keyframes, {+ atFrame: durationFrames,+ style: element.animation.keyframes.at(-1)!.style,+ }];+ const frames = keyframes.map((keyframe) => {const easing = keyframe.easing === undefined ? "" : `;animation-timing-function:${keyframe.easing}`;return `${percentage(keyframe.atFrame, durationFrames)}{${css(keyframe.style)}${easing}}`;}).join("");@@ -584,10 +587,11 @@ function frameAnimationRuntime(numerator: number, denominator: number): string {if (animation === undefined) throw new Error("Visual IR frame animation did not materialize.");const start = Number(element.getAttribute("data-svml-animation-start-frame"));const duration = Number(element.getAttribute("data-svml-animation-duration-frames"));+ const sampleDuration = Number(element.getAttribute("data-svml-animation-sample-frames"));const properties = String(element.getAttribute("data-svml-animation-properties") || "").split(",").filter(Boolean);const frames = [];- for (let frame = 0; frame <= duration; frame += 1) {+ for (let frame = 0; frame <= sampleDuration; frame += 1) {animation.currentTime = frame * millisecondsPerFrame;animation.pause();const style = getComputedStyle(element);@@ -595,7 +599,7 @@ function frameAnimationRuntime(numerator: number, denominator: number): string {}animation.cancel();element.style.animationName = "none";- timelines.push({ element, start, duration, frames });+ timelines.push({ element, start, duration: sampleDuration, frames });}const applyFrame = (time) => {const programFrame = Math.max(0, Math.round(Number(time || 0) * numerator / denominator));diff --git a/packages/hyperframes/test/document.test.ts b/packages/hyperframes/test/document.test.tsindex 8067d0fa..b46a5587 100644--- a/packages/hyperframes/test/document.test.ts+++ b/packages/hyperframes/test/document.test.ts@@ -198,9 +198,32 @@ test("HyperFrames emits frame-bound local animation without creating a Track staassert.match(document.html, /@keyframes svml-/u);assert.match(document.html, /33\.333333333%\{opacity:1;transform:translateY\(0%\)/u);assert.match(document.html, /animation-duration:1\.001s/u);+ assert.match(document.html, /100%\{opacity:1;transform:translateY\(0%\)\}/u);assert.doesNotMatch(document.html, /isolation:isolate/u);});+test("HyperFrames clips a long animation by Present visibility instead of rejecting it", () => {+ const { composition, programSpace } = fixture();+ const lower = composition.tracks.find((track) => track.id === "lower");+ assert(lower?.contract === "svml.visual-track@1");+ const present = lower.presents[0]!;+ const media = present.elements[0]!;+ const animated = sealVisualTrack({+ ...lower,+ presents: [{ ...present, elements: [{ ...media, animation: { keyframes: [+ { atFrame: 0, style: [{ name: "opacity", value: 0 }] },+ { atFrame: 45, style: [{ name: "opacity", value: 1 }] },+ ] } }] }],+ });+ const document = compileHyperframesDocument(sealComposition({+ ...composition,+ tracks: composition.tracks.map((track) => track.id === "lower" ? animated : track),+ }), programSpace);+ assert.match(document.html, /animation-duration:1\.5015s/u);+ assert.match(document.html, /data-svml-animation-duration-frames="45" data-svml-animation-sample-frames="30"/u);+ assert.match(document.html, /100%\{opacity:1\}/u);+});+test("content-bound fonts and typed compositable Surfaces cross the same Artifact boundary", () => {const space = sealProgramSpace({contract: "svml.program-space@1",diff --git a/packages/media-track/src/motion.ts b/packages/media-track/src/motion.tsindex 8fe3171a..2f96c16b 100644--- a/packages/media-track/src/motion.ts+++ b/packages/media-track/src/motion.ts@@ -88,9 +88,6 @@ export function assertMediaLifecycleMotion(value: MediaLifecycleMotion, durationif (value.enter !== undefined) assertMediaEdgeMotion(value.enter, `${label}.enter`);if (value.exit !== undefined) assertMediaEdgeMotion(value.exit, `${label}.exit`);for (const [index, sustain] of value.sustain.entries()) assertMediaSustainMotion(sustain, `${label}.sustain.${index}`);- const enter = value.enter?.durationFrames ?? 0;- const exit = value.exit?.durationFrames ?? 0;- assert(enter + exit <= durationFrames, `${label} entry and exit durations overlap.`);}type MotionState = {@@ -114,32 +111,6 @@ function translate(directionValue: MediaMotionDirection, amount: number): stringreturn `translateY(${amount}px)`;}-function wipe(directionValue: MediaMotionDirection): string {- if (directionValue === "left") return "inset(0% 0% 0% 100%)";- if (directionValue === "right") return "inset(0% 100% 0% 0%)";- if (directionValue === "up") return "inset(0% 0% 100% 0%)";- return "inset(100% 0% 0% 0%)";-}--function edgeState(value: MediaEdgeMotion): MotionState {- const amount = value.amount ?? (value.operator === "blur-reveal" ? 16 : value.operator === "scale" ? 0.8 : 100);- switch (value.operator) {- case "fade": return { ...neutral, opacity: 0 };- case "slide": return { ...neutral, transform: translate(value.direction!, amount) };- case "scale": return { ...neutral, transform: `scale(${amount})` };- case "pop": return { ...neutral, opacity: 0, transform: `scale(${value.amount ?? 0.7})` };- case "bounce": return { ...neutral, opacity: 0, transform: `translateY(${value.amount ?? 80}px) scale(0.92)` };- case "blur-reveal": return { ...neutral, opacity: 0, filter: `blur(${amount}px)` };- case "wipe": return { ...neutral, clipPath: wipe(value.direction!) };- case "flip": {- const axis = value.direction === "left" || value.direction === "right" ? "Y" : "X";- const sign = value.direction === "left" || value.direction === "up" ? -1 : 1;- return { ...neutral, opacity: 0, transform: `perspective(800px) rotate${axis}(${sign * (value.amount ?? 90)}deg)` };- }- case "spin": return { ...neutral, opacity: 0, transform: `rotate(${value.amount ?? 180}deg) scale(0.8)` };- }-}-function style(state: MotionState): VisualStyleDeclaration[] {return [{ name: "clip-path", value: state.clipPath },@@ -149,40 +120,21 @@ function style(state: MotionState): VisualStyleDeclaration[] {];}-function addState(- states: Map<number, { readonly state: MotionState; readonly easing?: VisualEasing }>,- frame: number,- state: MotionState,- easing?: VisualEasing,-): void {- const previous = states.get(frame);- if (previous !== undefined) {- assert(JSON.stringify(previous.state) === JSON.stringify(state),- `Media lifecycle produces conflicting states at frame ${frame}.`);- }- states.set(frame, { state, ...(easing === undefined ? {} : { easing }) });-}-export function lifecycleAnimation(value: MediaLifecycleMotion, durationFrames: number): VisualAnimation | undefined {assertMediaLifecycleMotion(value, durationFrames, "Media lifecycle");if (value.enter === undefined && value.exit === undefined) return undefined;- const states = new Map<number, { readonly state: MotionState; readonly easing?: VisualEasing }>();- if (value.enter === undefined) addState(states, 0, neutral);- else {- addState(states, 0, edgeState(value.enter), value.enter.easing);- addState(states, value.enter.durationFrames, neutral);+ const frames = new Set<number>([0, durationFrames]);+ if (value.enter !== undefined) {+ for (let frame = 0; frame <= Math.min(durationFrames, value.enter.durationFrames); frame += 1) frames.add(frame);}- if (value.exit === undefined) addState(states, durationFrames, neutral);- else {- const exitStart = durationFrames - value.exit.durationFrames;- addState(states, exitStart, neutral, value.exit.easing);- addState(states, durationFrames, edgeState(value.exit));+ if (value.exit !== undefined) {+ for (let frame = Math.max(0, durationFrames - value.exit.durationFrames); frame <= durationFrames; frame += 1) frames.add(frame);}return {- keyframes: [...states.entries()].sort(([left], [right]) => left - right).map(([atFrame, item]) => ({+ keyframes: [...frames].sort((left, right) => left - right).map((atFrame) => ({atFrame,- ...(item.easing === undefined ? {} : { easing: item.easing }),- style: style(item.state),+ easing: "linear",+ style: style(lifecycleStateAt(value, durationFrames, atFrame)),})),};}@@ -332,17 +284,30 @@ function edgeStateAt(value: MediaEdgeMotion, progressToNeutral: number): MotionS}function lifecycleStateAt(value: MediaLifecycleMotion, durationFrames: number, frame: number): MotionState {- if (value.enter !== undefined && frame < value.enter.durationFrames) {- return edgeStateAt(value.enter, eased(frame / value.enter.durationFrames, value.enter.easing));- }+ const enter = value.enter !== undefined && frame < value.enter.durationFrames+ ? edgeStateAt(value.enter, eased(frame / value.enter.durationFrames, value.enter.easing))+ : neutral;+ let exit = neutral;if (value.exit !== undefined) {const exitStart = durationFrames - value.exit.durationFrames;if (frame > exitStart) {const progress = eased((frame - exitStart) / value.exit.durationFrames, value.exit.easing);- return edgeStateAt(value.exit, 1 - progress);+ exit = edgeStateAt(value.exit, 1 - progress);}}- return neutral;+ const transforms = [enter.transform, exit.transform].filter((item) => item !== "none");+ const filters = [enter.filter, exit.filter].filter((item) => item !== "none");+ const clip = (input: string): readonly number[] => /^inset\(([-.\d]+)% ([-.\d]+)% ([-.\d]+)% ([-.\d]+)%\)$/u+ .exec(input)?.slice(1).map(Number) ?? [0, 0, 0, 0];+ const left = clip(enter.clipPath);+ const right = clip(exit.clipPath);+ const clipped = left.map((item, index) => Math.max(item, right[index] ?? 0));+ return {+ opacity: clean(enter.opacity * exit.opacity),+ transform: transforms.join(" ") || "none",+ filter: filters.join(" ") || "none",+ clipPath: `inset(${clipped.map((item) => `${clean(item)}%`).join(" ")})`,+ };}/** Slice one outer lifecycle over a member Present; entry/exit never restart at member boundaries. */diff --git a/packages/media-track/test/media-track.test.ts b/packages/media-track/test/media-track.test.tsindex ce479db0..f791564a 100644--- a/packages/media-track/test/media-track.test.ts+++ b/packages/media-track/test/media-track.test.ts@@ -343,13 +343,15 @@ test("timed layer trim/hold, lifecycle and sampling motion remain separate wrapp{ target: { startFrame: 0, endFrameExclusive: 30 }, sourceFrame: { numerator: 10, denominator: 1 }, rate: { numerator: 1, denominator: 1 } },{ target: { startFrame: 30, endFrameExclusive: 120 }, sourceFrame: { numerator: 39, denominator: 1 }, rate: { numerator: 0, denominator: 1 } },]);- assert.throws(() => appendProgramMediaItem(createMediaTrackSet(), header, space, canvas, layers, frame, itemSpec({- motion: {- enter: { operator: "fade", durationFrames: 70, easing: "linear" },- sustain: [],- exit: { operator: "fade", durationFrames: 60, easing: "linear" },- },- }), createMediaSoundSet()), /overlap/u);+ const overlapping = lifecycleAnimation({+ enter: { operator: "fade", durationFrames: 70, easing: "linear" },+ sustain: [],+ exit: { operator: "fade", durationFrames: 60, easing: "linear" },+ }, 120)!;+ const overlapFrame = overlapping.keyframes.find((keyframe) => keyframe.atFrame === 65)!;+ const overlapOpacity = overlapFrame.style.find((declaration) => declaration.name === "opacity")?.value;+ assert.equal(typeof overlapOpacity, "number");+ assert.ok((overlapOpacity as number) > 0 && (overlapOpacity as number) < 1);});test("source audio and edge SFX project separately from the visual Track", () => {diff --git a/packages/ranking/src/render.ts b/packages/ranking/src/render.tsindex ffae0de1..40d06037 100644--- a/packages/ranking/src/render.ts+++ b/packages/ranking/src/render.ts@@ -32,6 +32,8 @@ import {assertTierBoardProgram,assertTopThreeProgram,assertTypewriterListProgram,+ fitRankingStageMotion,+ fitTypewriterStage,graphemes,} from "./schedule.js";import type {@@ -305,12 +307,13 @@ export function renderTierBoard(space: ProgramSpace, program: TierBoardProgram):assert(x + style.iconSizePx <= frame.xPx + frame.widthPx - style.paddingPx,`TierBoard row ${item.tier} cannot fit Item ${item.id}.`);const duration = entry.stage.endFrameExclusive - entry.stage.startFrame;+ const fitted = fitRankingStageMotion(duration, style.motion.appearFrames, style.motion.moveFrames, item.entry === "stage");const rootAnimation = item.entry === "direct"- ? directItemAnimation(duration, style.motion.appearFrames)+ ? directItemAnimation(duration, fitted.appearFrames): settledItemAnimation({duration,- appearFrames: style.motion.appearFrames,- moveStart: entry.stage.endFrameExclusive - style.motion.moveFrames - entry.triggerFrame,+ appearFrames: fitted.appearFrames,+ moveStart: entry.stage.endFrameExclusive - fitted.moveFrames - entry.triggerFrame,moveEnd: entry.stage.endFrameExclusive - entry.triggerFrame,stageTransform: stageTransform(x, y,@@ -400,13 +403,14 @@ export function renderColumn(space: ProgramSpace, program: ColumnProgram): Visuaconst y = rowY(frame.yPx, frame.heightPx, style.paddingPx, program.items.length, index, style.rowHeightPx, style.rowGapPx);const width = frame.widthPx - style.paddingPx * 2;const duration = entry.stage.endFrameExclusive - entry.triggerFrame;+ const fitted = fitRankingStageMotion(duration, style.motion.appearFrames, style.motion.moveFrames, true);const targetStageX = frame.xPx + frame.widthPx * style.stagePoint.x - width / 2;const targetStageY = frame.yPx + frame.heightPx * style.stagePoint.y - style.rowHeightPx / 2;const root = `column-item-${item.id}`;const rootAnimation = settledItemAnimation({duration,- appearFrames: style.motion.appearFrames,- moveStart: entry.stage.endFrameExclusive - style.motion.moveFrames - entry.triggerFrame,+ appearFrames: fitted.appearFrames,+ moveStart: entry.stage.endFrameExclusive - fitted.moveFrames - entry.triggerFrame,moveEnd: entry.stage.endFrameExclusive - entry.triggerFrame,stageTransform: stageTransform(x, y, targetStageX, targetStageY, style.stageSizePx / style.rowHeightPx),easing: style.motion.easing,@@ -493,7 +497,8 @@ export function renderTopThree(space: ProgramSpace, program: TopThreeProgram): Vconst elements: VisualElement[] = [absoluteBox({id: root, order: 0, x, y, width: style.iconSizePx,height: style.iconSizePx + style.labelGapPx + style.text.sizePx * style.text.lineHeight,- ...(active ? { animation: directItemAnimation(duration, style.motion.appearFrames) } : {}),+ ...(active ? { animation: directItemAnimation(duration,+ fitRankingStageMotion(duration, style.motion.appearFrames, style.motion.moveFrames, false).appearFrames) } : {}),})];if (active) elements.push(absoluteBox({ id: accent, parent: root, order: 1, x: 0, y: 0, width: style.iconSizePx, height: style.iconSizePx,style: [@@ -601,7 +606,7 @@ export function renderTypewriterList(space: ProgramSpace, program: TypewriterLisconst entry = schedule.entries[index]!;const duration = entry.stage.endFrameExclusive - entry.triggerFrame;const count = graphemes(item.text).length;- const typedFrames = count * style.framesPerGrapheme;+ const fitted = fitTypewriterStage(duration, count, style.framesPerGrapheme, item.winner ? style.winnerFrames : 0);const root = `typewriter-item-${item.id}`;const y = firstRowY + index * (rowHeight + style.rowGapPx);const paints: VisualTextPaintLayer[] = [{ kind: "fill", paint: { kind: "solid", color: style.item.color } }];@@ -618,15 +623,18 @@ export function renderTypewriterList(space: ProgramSpace, program: TypewriterLis],document: typewriterDocument(item, style), typography: visualTypography(style.item), paints,flow: areaFlow,- sequences: active ? [{- id: `${item.id}-typing`, unit: "grapheme", range: { start: 0, endExclusive: count },- order: "forward", startFrame: 0, unitDurationFrames: 1, staggerFrames: style.framesPerGrapheme,- cycles: 1,- keyframes: [- { atProgress: 0, style: [{ name: "opacity", value: 0 }] },- { atProgress: 1, style: [{ name: "opacity", value: 1 }] },- ],- }] : [],+ sequences: active && fitted.typingFrames > 0+ ? Array.from({ length: count }, (_, grapheme) => ({+ id: `${item.id}-typing-${grapheme + 1}`, unit: "grapheme" as const,+ range: { start: grapheme, endExclusive: grapheme + 1 }, order: "forward" as const,+ startFrame: Math.floor(grapheme * fitted.typingFrames / count),+ unitDurationFrames: 1, staggerFrames: 0, cycles: 1,+ keyframes: [+ { atProgress: 0, style: [{ name: "opacity", value: 0 }] },+ { atProgress: 1, style: [{ name: "opacity", value: 1 }] },+ ],+ }))+ : [],}];if (item.winner) elements.push(simpleText({id: "winner", parent: root, order: 2, text: "★",@@ -634,8 +642,8 @@ export function renderTypewriterList(space: ProgramSpace, program: TypewriterLisx: frame.widthPx - style.paddingPx - rowHeight, y, width: rowHeight, height: rowHeight,...(active ? { animation: animation(duration, [{ atFrame: 0, style: transformStyle("scale(0.5)", 0) },- { atFrame: typedFrames, style: transformStyle("scale(0.5)", 0), easing: "ease-out" },- { atFrame: typedFrames + style.winnerFrames, style: transformStyle("scale(1)", 1) },+ { atFrame: fitted.typingFrames, style: transformStyle("scale(0.5)", 0), easing: "ease-out" },+ { atFrame: fitted.typingFrames + fitted.winnerFrames, style: transformStyle("scale(1)", 1) },]) } : {}),}));return elements;diff --git a/packages/ranking/src/schedule.ts b/packages/ranking/src/schedule.tsindex 3faf0630..c74f7642 100644--- a/packages/ranking/src/schedule.ts+++ b/packages/ranking/src/schedule.ts@@ -523,13 +523,30 @@ function idsEqual(schedule: RankingSchedule, items: readonly { readonly id: stri}}-function validateStageDurations(schedule: RankingSchedule, style: RankingMotionStyle, needsMove: (index: number) => boolean): void {- for (const [index, entry] of schedule.entries.entries()) {- const duration = entry.stage.endFrameExclusive - entry.stage.startFrame;- const required = style.appearFrames + (needsMove(index) ? style.moveFrames : 0);- assert(required <= duration,- `Ranking Item ${entry.itemId} stage has ${duration} frames but requires ${required} animation frames.`);- }+export function fitRankingStageMotion(+ durationFrames: number,+ preferredAppearFrames: number,+ preferredMoveFrames: number,+ needsMove: boolean,+): { readonly appearFrames: number; readonly moveFrames: number } {+ assert(Number.isSafeInteger(durationFrames) && durationFrames > 0, "Ranking stage duration is invalid.");+ if (!needsMove) return { appearFrames: Math.min(preferredAppearFrames, durationFrames), moveFrames: 0 };+ const moveFrames = Math.min(preferredMoveFrames, durationFrames);+ return { appearFrames: Math.min(preferredAppearFrames, durationFrames - moveFrames), moveFrames };+}++export function fitTypewriterStage(+ durationFrames: number,+ graphemeCount: number,+ preferredFramesPerGrapheme: number,+ preferredWinnerFrames: number,+): { readonly typingFrames: number; readonly winnerFrames: number } {+ assert(Number.isSafeInteger(durationFrames) && durationFrames > 0, "Typewriter stage duration is invalid.");+ const winnerFrames = Math.min(preferredWinnerFrames, durationFrames);+ return {+ typingFrames: Math.min(graphemeCount * preferredFramesPerGrapheme, durationFrames - winnerFrames),+ winnerFrames,+ };}export function buildTierBoardProgram(header: RankingHeader, frameValue: import("@narratage/spatial").SpatialFrame, schedule: RankingSchedule, style: TierBoardStyle, set: TierBoardItemSet): TierBoardProgram {@@ -539,7 +556,6 @@ export function buildTierBoardProgram(header: RankingHeader, frameValue: import(idsEqual(schedule, set.items);const rows = new Set(style.rows.map((row) => row.id));for (const item of set.items) assert(rows.has(item.tier), `TierBoard Item ${item.id} references unknown tier ${item.tier}.`);- validateStageDurations(schedule, style.motion, (index) => set.items[index]?.entry === "stage");const result: TierBoardProgram = { contract: "svml.tier-board-program@1", id: header.id, frame: structuredClone(frameValue), schedule: structuredClone(schedule), style: structuredClone(style), items: structuredClone(set.items) };assertTierBoardProgram(result);return canonicalize(result) as unknown as TierBoardProgram;@@ -550,7 +566,6 @@ export function buildColumnProgram(header: RankingHeader, frameValue: import("@nassertSpatialFrame(frameValue);assertColumnStyle(style);idsEqual(schedule, set.items);- validateStageDurations(schedule, style.motion, () => true);const result: ColumnProgram = { contract: "svml.column-program@1", id: header.id, frame: structuredClone(frameValue), schedule: structuredClone(schedule), style: structuredClone(style), items: structuredClone(set.items) };assertColumnProgram(result);return canonicalize(result) as unknown as ColumnProgram;@@ -562,7 +577,6 @@ export function buildTopThreeProgram(header: RankingHeader, frameValue: import("assertTopThreeStyle(style);idsEqual(schedule, set.items);assert(set.items.length <= 3, "TopThree accepts at most three Items.");- validateStageDurations(schedule, style.motion, () => false);const result: TopThreeProgram = { contract: "svml.top-three-program@1", id: header.id, frame: structuredClone(frameValue), schedule: structuredClone(schedule), style: structuredClone(style), items: structuredClone(set.items) };assertTopThreeProgram(result);return canonicalize(result) as unknown as TopThreeProgram;@@ -578,14 +592,10 @@ export function buildTypewriterListProgram(header: RankingHeader, title: string,assertSpatialFrame(frameValue);assertTypewriterListStyle(style);idsEqual(schedule, set.items);- for (const [index, item] of set.items.entries()) {+ for (const item of set.items) {const count = graphemes(item.text).length;if (item.emphasis !== undefined) assert(item.emphasis.endExclusive <= count,`Typewriter Item ${item.id} emphasis exceeds its grapheme count.`);- const duration = schedule.entries[index]!.stage.endFrameExclusive - schedule.entries[index]!.stage.startFrame;- const required = count * style.framesPerGrapheme + (item.winner ? style.winnerFrames : 0);- assert(required <= duration,- `Typewriter Item ${item.id} stage has ${duration} frames but typing${item.winner ? " and winner mark" : ""} requires ${required}.`);}const result: TypewriterListProgram = { contract: "svml.typewriter-list-program@1", id: header.id, title, frame: structuredClone(frameValue), schedule: structuredClone(schedule), style: structuredClone(style), items: structuredClone(set.items) };assertTypewriterListProgram(result);@@ -650,8 +660,10 @@ export function buildTierBoardSoundEvents(schedule: RankingSchedule, style: TieridsEqual(schedule, specs.items);const events = schedule.entries.flatMap((entry, index) => {const spec = specs.items[index] as TierBoardItemSpec;+ const duration = entry.stage.endFrameExclusive - entry.triggerFrame;+ const fitted = fitRankingStageMotion(duration, style.motion.appearFrames, style.motion.moveFrames, spec.entry === "stage");return [event(schedule.id, entry.itemId, "appear", entry.triggerFrame),- ...(spec.entry === "stage" ? [event(schedule.id, entry.itemId, "move", entry.stage.endFrameExclusive - style.motion.moveFrames)] : [])];+ ...(spec.entry === "stage" ? [event(schedule.id, entry.itemId, "move", entry.stage.endFrameExclusive - fitted.moveFrames)] : [])];});return sealEvents(schedule.id, schedule.variant, events);}@@ -660,10 +672,12 @@ export function buildColumnSoundEvents(schedule: RankingSchedule, style: ColumnSassert(schedule.variant === "column" && specs.variant === "column", "Column event inputs disagree.");assertColumnStyle(style);idsEqual(schedule, specs.items);- return sealEvents(schedule.id, schedule.variant, schedule.entries.flatMap((entry) => [- event(schedule.id, entry.itemId, "appear", entry.triggerFrame),- event(schedule.id, entry.itemId, "move", entry.stage.endFrameExclusive - style.motion.moveFrames),- ]));+ return sealEvents(schedule.id, schedule.variant, schedule.entries.flatMap((entry) => {+ const duration = entry.stage.endFrameExclusive - entry.triggerFrame;+ const fitted = fitRankingStageMotion(duration, style.motion.appearFrames, style.motion.moveFrames, true);+ return [event(schedule.id, entry.itemId, "appear", entry.triggerFrame),+ event(schedule.id, entry.itemId, "move", entry.stage.endFrameExclusive - fitted.moveFrames)];+ }));}export function buildTopThreeSoundEvents(schedule: RankingSchedule, style: TopThreeStyle, specs: RankingItemSpecSet): RankingSoundEventPlan {@@ -680,9 +694,11 @@ export function buildTypewriterSoundEvents(schedule: RankingSchedule, style: TypidsEqual(schedule, specs.items);return sealEvents(schedule.id, schedule.variant, schedule.entries.flatMap((entry, index) => {const spec = specs.items[index] as TypewriterItemSpec;- const typed = graphemes(spec.text).length * style.framesPerGrapheme;+ const duration = entry.stage.endFrameExclusive - entry.triggerFrame;+ const fitted = fitTypewriterStage(duration, graphemes(spec.text).length, style.framesPerGrapheme,+ spec.winner ? style.winnerFrames : 0);return [event(schedule.id, entry.itemId, "appear", entry.triggerFrame),- ...(spec.winner ? [event(schedule.id, entry.itemId, "move", entry.triggerFrame + typed)] : [])];+ ...(spec.winner ? [event(schedule.id, entry.itemId, "move", entry.triggerFrame + fitted.typingFrames)] : [])];}));}diff --git a/packages/ranking/test/ranking.test.ts b/packages/ranking/test/ranking.test.tsindex 650c97d8..3eb28e46 100644--- a/packages/ranking/test/ranking.test.ts+++ b/packages/ranking/test/ranking.test.ts@@ -193,7 +193,7 @@ test("variant Style decoders reject unknown Recipes and keep exact fonts and indassert.equal(decodeTypewriterListStyle(recipe("ranking.typewriter"), font).style.framesPerGrapheme, 2);});-test("TierBoard owns cumulative direct/stage placement and rejects impossible stages", () => {+test("TierBoard owns cumulative direct/stage placement and rejects invalid schedule boundaries", () => {const owner = header("tier-board", "tiers");const semantic = [tierSpec("alpha", "s", "stage"), tierSpec("beta", "a")];const style = decodeTierBoardStyle(recipe("ranking.tier", {@@ -270,14 +270,18 @@ test("Typewriter uses Unicode graphemes, explicit emphasis and winner timing witconst row = track.presents.find((item) => item.id.endsWith(":item:first:stage"))!;const text = row.elements.find((item) => item.kind === "text-flow");assert.equal(text?.kind, "text-flow");- assert.equal(text?.sequences[0]?.range.endExclusive, 3);+ assert.deepEqual(text?.sequences.map((sequence) => sequence.range), [+ { start: 0, endExclusive: 1 },+ { start: 1, endExclusive: 2 },+ { start: 2, endExclusive: 3 },+ ]);const emphasis = text?.document.paragraphs[0]?.inlines[1];assert.equal(emphasis?.kind, "text");assert.equal(emphasis.kind === "text" ? emphasis.text : undefined, "👩💻");assert.ok(row.elements.some((item) => item.kind === "text" && item.text === "★"));- assert.throws(() => buildTypewriterListProgram(owner, "Tools", frame, schedule(owner, semantic), {+ assert.doesNotThrow(() => buildTypewriterListProgram(owner, "Tools", frame, schedule(owner, semantic), {...style, framesPerGrapheme: 20,- }, set), /requires/u);+ }, set));});const sound = (id: string, sampleFrames = 4_800): SynchronizedMedia => ({diff --git a/packages/screen-overlay/src/program.ts b/packages/screen-overlay/src/program.tsindex ce8179d8..1bf4f56d 100644--- a/packages/screen-overlay/src/program.ts+++ b/packages/screen-overlay/src/program.ts@@ -202,7 +202,6 @@ function animation(duration: number, start: readonly VisualStyleDeclaration[], e}function flashElements(content: Extract<ScreenOverlayComponent, { kind: "flash" }>, duration: number): readonly VisualElement[] {const total = content.attackFrames + content.holdFrames + content.decayFrames;- assert(total <= duration, "Flash envelope exceeds its projected window.");if (total === 0) return [{ id: "root", order: 0, kind: "box", style: [...rootStyle(), { name: "background-color", value: content.color }, { name: "opacity", value: content.intensity }] }];const marks = new Map<number, number>();marks.set(0, content.attackFrames === 0 ? content.intensity : 0);diff --git a/packages/screen-overlay/test/screen-overlay.test.ts b/packages/screen-overlay/test/screen-overlay.test.tsindex ba1614d3..8d12788b 100644--- a/packages/screen-overlay/test/screen-overlay.test.ts+++ b/packages/screen-overlay/test/screen-overlay.test.ts@@ -86,7 +86,8 @@ test("every declared Screen Overlay component lowers to a self-contained determitest("Flash owns its exact envelope instead of inheriting a universal peak", () => {const flash = trackFor(components[0]!);assert.deepEqual(flash.presents[0]?.elements[0]?.animation?.keyframes.map((frame) => frame.atFrame), [0, 2, 5, 10, 60]);- assert.throws(() => trackFor({ kind: "flash", color: "#ffffff", intensity: 1, attackFrames: 30, holdFrames: 30, decayFrames: 30 }), /envelope exceeds/u);+ const clipped = trackFor({ kind: "flash", color: "#ffffff", intensity: 1, attackFrames: 30, holdFrames: 30, decayFrames: 30 });+ assert.deepEqual(clipped.presents[0]?.elements[0]?.animation?.keyframes.map((frame) => frame.atFrame), [0, 30, 60, 90]);});test("explicit seeds control stochastic component identity", () => {diff --git a/packages/typography-track/src/program.ts b/packages/typography-track/src/program.tsindex 20444e97..24215293 100644--- a/packages/typography-track/src/program.ts+++ b/packages/typography-track/src/program.ts@@ -607,24 +607,13 @@ function maskTextElement(item: TextItem): VisualTextElement {};}-function assertMotionDomain(item: TextItem, durationFrames: number): void {- if (item.motion.item !== undefined && item.motion.item.keyframes.at(-1)?.atFrame !== durationFrames) {- throw new Error(`${item.id} item motion does not cover its complete window.`);- }- if (item.motion.item !== undefined && item.motion.item.keyframes[0]?.atFrame !== 0) {- throw new Error(`${item.id} item motion must start at frame zero.`);- }+function assertMotionDomain(item: TextItem): void {if (item.motion.pathMargin !== undefined) {if (item.geometry.kind !== "path") throw new Error(`${item.id} path-margin motion requires Path Text.`);- if (item.motion.pathMargin.keyframes[0]?.atFrame !== 0- || item.motion.pathMargin.keyframes.at(-1)?.atFrame !== durationFrames) {- throw new Error(`${item.id} path-margin motion must cover its complete window.`);- }}}function elements(item: TextItem): VisualElement[] {- const durationFrames = item.span.endFrameExclusive - item.span.startFrame;const rootStyle = baseBoxStyle(item.geometry);const anchor = pointAnchorTransform(item);if (anchor !== undefined) rootStyle.push({ name: "transform", value: anchor });@@ -639,7 +628,7 @@ function elements(item: TextItem): VisualElement[] {: [{ name: "position", value: "absolute" }, { name: "inset", value: 0 }],...(item.motion.item === undefined ? {} : { animation: item.motion.item }),};- assertMotionDomain(item, durationFrames);+ assertMotionDomain(item);return [root, motion, terminalTextElement(item, "motion", 2)];}@@ -677,8 +666,7 @@ export function renderTextMaskTrack(visualIr: "svml.visual-ir@1",id: spec.id,presents: program.items.map((item) => {- const durationFrames = item.span.endFrameExclusive - item.span.startFrame;- assertMotionDomain(item, durationFrames);+ assertMotionDomain(item);const style = baseBoxStyle(item.geometry);const anchor = pointAnchorTransform(item);if (anchor !== undefined) style.push({ name: "transform", value: anchor });diff --git a/packages/typography-track/test/typography-track.test.ts b/packages/typography-track/test/typography-track.test.tsindex 7ff993ac..7904e270 100644--- a/packages/typography-track/test/typography-track.test.ts+++ b/packages/typography-track/test/typography-track.test.ts@@ -549,7 +549,7 @@ test("rich Text lowers ordered glyph layers, boxes, bounded flow, sequences andid: "sequenced",item: { keyframes: [{ atFrame: 0, style: [{ name: "opacity", value: 0 }, { name: "transform", value: "translateY(20px)" }] },- { atFrame: 150, easing: "ease-out", style: [{ name: "opacity", value: 1 }, { name: "transform", value: "translateY(0px)" }] },+ { atFrame: 10, easing: "ease-out", style: [{ name: "opacity", value: 1 }, { name: "transform", value: "translateY(0px)" }] },] },sequences: [{@@ -572,7 +572,7 @@ test("rich Text lowers ordered glyph layers, boxes, bounded flow, sequences and});const pathMotion = sealTextMotion({contract: "svml.text-motion@1", id: "path-motion", sequences: [],- pathMargin: { keyframes: [{ atFrame: 0, startMarginPx: 0 }, { atFrame: 150, startMarginPx: 120, easing: "ease-in-out" }] },+ pathMargin: { keyframes: [{ atFrame: 0, startMarginPx: 0 }, { atFrame: 180, startMarginPx: 120, easing: "ease-in-out" }] },});const track = renderTypographyTrack(space, sealTypographyTrackProgram({contract: "svml.typography-track-program@1",diff --git a/spec/caption-fine.md b/spec/caption-fine.mdindex 05069d1b..64e99e10 100644--- a/spec/caption-fine.md+++ b/spec/caption-fine.md@@ -153,22 +153,26 @@ internal Word timestamps that the author and audio evidence never supplied.### 7. Layered local motion-- Cue enter/exit: `none | fade | pop | spring | slide-left | slide-right | slide-up | slide-down | blur-in`-- Atom entry: the same one-shot vocabulary+- Cue enter/exit: `none | fade | pop | scale | spring | bounce | elastic | stamp | tilt |+ zoom-blur | flip-x | flip-y | spin | squash | stretch | slide-left | slide-right | slide-up |+ slide-down | blur-in | wipe-left | wipe-right | wipe-up | wipe-down`+- Atom entry and exit: the same one-shot vocabulary, with independent durations- Atom reveal: `all | on-start | typewriter`-- active response: `none | scale | pop | spring`-- active-box enter/exit: `none | fade | pop`-- continuous local loop: `none | shake | wobble | glow-pulse`, targeted at the Cue or active Atom+- active response and active-box enter/exit: the same one-shot vocabulary+- continuous local loop: `none | shake | wobble | glow-pulse | breathe | float | pulse | flicker`,+ targeted at the Cue or active AtomThe flat Recipe names are `cue-enter`, `cue-exit`, their independent `*-frames`; `atom-enter`,-`atom-enter-frames`, `atom-reveal`; `active-response`, `active-response-frames`, `active-scale`;+`atom-enter-frames`, `atom-exit`, `atom-exit-frames`, `atom-reveal`; `active-response`,+`active-response-frames`, `active-scale`;`slide-distance`; and `loop`, `loop-target`, `loop-period-frames`, `loop-intensity`.-Cue, Atom entry, active response and loop own separate wrappers, so their transforms compose instead+Cue, Atom lifecycle, active response and loop own separate wrappers, so their transforms compose insteadof overwriting one another. Typewriter reveals authored display graphemes inside a whole Atom; it isvisual interpolation, not a claim of character timestamps and never changes Atom boundaries.-Continuous motion is a bounded deterministic frame function with no random input. Bounce, arbitrary-rotation, path motion and random variation remain outside Fine.+Continuous motion is a bounded deterministic frame function with no random input. Arbitrary path+motion and random variation remain outside Fine; they belong to generic Typography or a separate+effect package rather than a Caption preset vocabulary.## One renderer, one layout treediff --git a/spec/media-track.md b/spec/media-track.mdindex 3bec1bec..b40c9b80 100644--- a/spec/media-track.md+++ b/spec/media-track.md@@ -367,8 +367,10 @@ Operates on one media layer's already fitted Content Frame. Normalized keyframessource/content-point displacement and rotation. Ken Burns is a sampling-motion Recipe, not a Baseeffect and not an occupancy mode.-Entry plus exit durations that overlap are rejected unless one explicit component defines the-combined behavior. The compiler does not proportionally shorten both as Twinit's renderer did.+Entry and exit keep their authored durations even when they overlap. The package evaluates both at+each frame and deterministically composes their independent opacity, transform, filter and clip+channels. It never proportionally shortens either side and never runs the Item twice. The visible+Item window remains the final clip.The transform stack is fixed so channels cannot overwrite one another:@@ -635,7 +637,7 @@ deterministic local compilation.- transparent, solid, gradient, self-blur and alternate-source backing layers;- every Content Fit and unequal content/frame focal point;- entry, sustain, exit and sampling motion separately and in combination;-- explicit failure for overlapping entry/exit durations.+- deterministic composition for overlapping entry/exit durations without hidden retiming.### Sequencediff --git a/spec/ranking-track.md b/spec/ranking-track.mdindex b439a5d0..42354a4e 100644--- a/spec/ranking-track.md+++ b/spec/ranking-track.md@@ -51,7 +51,8 @@ survive. The old implementation had these structural problems:5. one global z-index prevented the board and individual icons from interleaving with peer Tracks;6. raw URLs, environment font names, Remotion component ids and three mirrored registries leakedenvironment/renderer details into the component;-7. short windows could silently suppress motion sound instead of rejecting an impossible schedule.+7. short windows could silently suppress motion sound instead of fitting visual and sound phases to+ one shared finite schedule.Migration preserves the useful visual capabilities, not these accidental semantics.@@ -284,7 +285,8 @@ Acceptance requires:- trigger/item cardinality, stable identities and all boundary failures are tested;- `T < O` visibly proves a final settled suffix;-- short stages reject impossible animation rather than repairing it;+- short stages deterministically fit their local animation and sound phases without changing stage+ boundaries; a very short Typewriter stage may reveal several graphemes on the same frame;- board and per-item Presents interleave with a peer Track at unrelated absolute z positions;- visual and sound event frames agree exactly;- missing optional images work only for variants that declare them optional;diff --git a/spec/screen-overlay.md b/spec/screen-overlay.mdindex dc8911fb..1fbc3915 100644--- a/spec/screen-overlay.md+++ b/spec/screen-overlay.md@@ -121,8 +121,9 @@ an edge from one side to another; Grain may remain steady. The old universal triat 30% of every effect's duration is retired as hidden presentation policy.Recipe defaults may supply an envelope, but the resolved Program must contain the exact parameters.-An effect cannot expand its projected window to fit an animation. Invalid or zero-length windows-fail through the common temporal validator.+An effect cannot expand its projected window to fit an animation. A longer authored envelope is+simply clipped by that window; it is not rejected or secretly sped up. Invalid or zero-length+windows still fail through the common temporal validator.## 5. Portable official component setdiff --git a/spec/typography-track.md b/spec/typography-track.mdindex 5db27277..03b859d8 100644--- a/spec/typography-track.md+++ b/spec/typography-track.md@@ -340,6 +340,12 @@ finite or analytically bounded package-owned motion values before terminal rendechannels compose through separate owned wrappers or an explicit transform composition order; thelast one does not overwrite the previous one.+Animation lifetime is independent from Item visibility. A motion may finish before its Item window;+its final authored state then holds until the Item disappears. A motion may also extend beyond the+window; the Item window clips it without rewriting its timing. Sequence and Path Text motion follow+the same rule. This avoids rejecting a perfectly meaningful fast title animation merely because the+title remains visible, and avoids silently retiming a slow animation to fit a short window.+## 9. Style declaration, SVS and readable authoringDeclaration and use remain separate. SVS stays a generic scalar Recipe language; it must not learn