@omnimedia/omnitool 1.1.0-84 → 1.1.0-85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/s/demo/routines/timeline-setup.ts +1 -1
- package/s/timeline/parts/item.ts +2 -2
- package/s/timeline/renderers/parts/handy.ts +24 -5
- package/s/timeline/sugar/o.ts +1 -1
- package/x/demo/demo.bundle.min.js +4 -4
- package/x/demo/demo.bundle.min.js.map +3 -3
- package/x/demo/routines/timeline-setup.js +1 -1
- package/x/demo/routines/timeline-setup.js.map +1 -1
- package/x/index.html +2 -2
- package/x/tests.bundle.min.js +40 -40
- package/x/tests.bundle.min.js.map +3 -3
- package/x/tests.html +1 -1
- package/x/timeline/parts/item.d.ts +2 -2
- package/x/timeline/renderers/parts/handy.js +20 -5
- package/x/timeline/renderers/parts/handy.js.map +1 -1
- package/x/timeline/sugar/o.js +1 -1
- package/x/timeline/sugar/o.js.map +1 -1
package/README.md
CHANGED
|
@@ -233,7 +233,7 @@ const timeline = omni.timeline(o => {
|
|
|
233
233
|
duration: 2000,
|
|
234
234
|
styles: {fill: "white", fontSize: 36},
|
|
235
235
|
})
|
|
236
|
-
o.set(title.id, {
|
|
236
|
+
o.set(title.id, {animationIds: [fadeIn.id]})
|
|
237
237
|
|
|
238
238
|
return o.stack(
|
|
239
239
|
o.video(clip, {duration: 4000}),
|
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ export async function TimelineSchemaTest(driver: Driver, file: File) {
|
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
const video = o.video(videoA, {duration: 3000, start: 1000})
|
|
35
|
-
o.set<Item.Text>(text.id, {styleId: style.id, spatialId: textSpatial.id,
|
|
35
|
+
o.set<Item.Text>(text.id, {styleId: style.id, spatialId: textSpatial.id, animationIds: [fade.id]})
|
|
36
36
|
o.set<Item.Video>(video.id, {spatialId: videoSpatial.id})
|
|
37
37
|
|
|
38
38
|
return o.sequence(
|
package/s/timeline/parts/item.ts
CHANGED
|
@@ -94,7 +94,7 @@ export namespace Item {
|
|
|
94
94
|
start: number
|
|
95
95
|
duration: number
|
|
96
96
|
spatialId?: Id
|
|
97
|
-
|
|
97
|
+
animationIds?: Id[]
|
|
98
98
|
filterIds?: Id[]
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -113,7 +113,7 @@ export namespace Item {
|
|
|
113
113
|
content: string
|
|
114
114
|
duration: number
|
|
115
115
|
spatialId?: Id
|
|
116
|
-
|
|
116
|
+
animationIds?: Id[]
|
|
117
117
|
styleId?: Id
|
|
118
118
|
filterIds?: Id[]
|
|
119
119
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
|
|
2
|
+
import {Keyframes} from '../../types.js'
|
|
2
3
|
import {ms, Ms} from '../../../units/ms.js'
|
|
3
4
|
import {Id, TimelineFile} from '../../parts/basics.js'
|
|
4
5
|
import { SampleContext } from './samplers/visual/parts/types.js'
|
|
@@ -366,12 +367,30 @@ export function computeOpacity(
|
|
|
366
367
|
item: Item.Any,
|
|
367
368
|
time: Ms,
|
|
368
369
|
) {
|
|
369
|
-
if (!("
|
|
370
|
+
if (!("animationIds" in item) || item.animationIds === undefined)
|
|
370
371
|
return 1
|
|
371
372
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
373
|
+
let opacity = 1
|
|
374
|
+
for (const id of item.animationIds) {
|
|
375
|
+
const animation = ctx.items.get(id) as Item.Animation | undefined
|
|
376
|
+
const anim = animation?.anims.opacity
|
|
377
|
+
if (animation?.enabled && anim && keyframesActiveAt(anim.track, time))
|
|
378
|
+
opacity = resolveScalarAnimation(time, anim)
|
|
379
|
+
}
|
|
380
|
+
return opacity
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function keyframesActiveAt(keys: Keyframes, time: Ms) {
|
|
384
|
+
if (keys.length === 0)
|
|
385
|
+
return false
|
|
386
|
+
|
|
387
|
+
let start = keys[0][0]
|
|
388
|
+
let end = keys[0][0]
|
|
389
|
+
for (const [keyTime] of keys) {
|
|
390
|
+
start = Math.min(start, keyTime)
|
|
391
|
+
end = Math.max(end, keyTime)
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return time >= start && time <= end
|
|
376
395
|
}
|
|
377
396
|
|
package/s/timeline/sugar/o.ts
CHANGED