@omnimedia/omnitool 1.1.0-81 → 1.1.0-82
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 +10 -0
- package/package.json +1 -1
- package/s/timeline/index.ts +1 -0
- package/s/timeline/renderers/parts/handy.ts +2 -2
- package/s/timeline/utils/anim.ts +1 -1
- package/x/demo/demo.bundle.min.js.map +3 -3
- package/x/index.html +1 -1
- package/x/tests.bundle.min.js.map +3 -3
- package/x/timeline/index.d.ts +1 -0
- package/x/timeline/index.js +1 -0
- package/x/timeline/index.js.map +1 -1
- package/x/timeline/renderers/parts/handy.js +2 -2
- package/x/timeline/renderers/parts/handy.js.map +1 -1
- package/x/timeline/utils/anim.d.ts +1 -1
- package/x/timeline/utils/anim.js +1 -1
- package/x/timeline/utils/anim.js.map +1 -1
package/README.md
CHANGED
|
@@ -229,6 +229,16 @@ Object.entries(animations).forEach(([property, meta]) => {
|
|
|
229
229
|
|
|
230
230
|
Each animation definition describes the semantic shape of the animation: its value kind, default interpolation, and numeric channels with defaults and units. This is useful for tools that need to create valid keyframes without hardcoding Omnitool's track layout.
|
|
231
231
|
|
|
232
|
+
Utils:
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
import {resolveTransform} from "@omnimedia/omnitool"
|
|
236
|
+
|
|
237
|
+
const transform = resolveTransform(spatial, localTime)
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
`resolveTransform` gets a spatial item's current transform. It returns the static transform for `Item.Spatial`, or resolves the animated transform for `Item.AnimatedSpatial` at the given local time.
|
|
241
|
+
|
|
232
242
|
Worker URL notes:
|
|
233
243
|
- `Driver.setup()` defaults to `/node_modules/@omnimedia/omnitool/x/driver/driver.worker.bundle.min.js`.
|
|
234
244
|
- If you serve the worker from a different location, pass `workerUrl`:
|
package/package.json
CHANGED
package/s/timeline/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {ms, Ms} from '../../../units/ms.js'
|
|
|
3
3
|
import {Id, TimelineFile} from '../../parts/basics.js'
|
|
4
4
|
import { SampleContext } from './samplers/visual/parts/types.js'
|
|
5
5
|
import {I6, Mat6, mul6, transformToMat6} from '../../utils/matrix.js'
|
|
6
|
-
import {resolveScalarAnimation,
|
|
6
|
+
import {resolveScalarAnimation, resolveTransform} from '../../utils/anim.js'
|
|
7
7
|
import {ContainerItem, Item, Kind, PlayableItem, SpatialItem} from '../../parts/item.js'
|
|
8
8
|
|
|
9
9
|
function isPlayableItem(item: Item.Any): item is PlayableItem {
|
|
@@ -101,7 +101,7 @@ function applySpatialIfAny(
|
|
|
101
101
|
if ("spatialId" in item && item.spatialId) {
|
|
102
102
|
const spatial = items.get(item.spatialId) as SpatialItem | undefined
|
|
103
103
|
if (spatial?.enabled) {
|
|
104
|
-
const local = transformToMat6(
|
|
104
|
+
const local = transformToMat6(resolveTransform(spatial, time))
|
|
105
105
|
return mul6(local, parentMatrix)
|
|
106
106
|
}
|
|
107
107
|
}
|
package/s/timeline/utils/anim.ts
CHANGED
|
@@ -62,7 +62,7 @@ export const resolveScalarAnimation =(
|
|
|
62
62
|
anim: ScalarAnimation,
|
|
63
63
|
): number => resolveScalar(time, anim.track, anim.terp)
|
|
64
64
|
|
|
65
|
-
export const
|
|
65
|
+
export const resolveTransform =(
|
|
66
66
|
spatial: Item.Spatial | Item.AnimatedSpatial,
|
|
67
67
|
time: number,
|
|
68
68
|
): Transform =>
|