@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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnimedia/omnitool",
3
- "version": "1.1.0-81",
3
+ "version": "1.1.0-82",
4
4
  "description": "open source video processing tools",
5
5
  "license": "MIT",
6
6
  "author": "Przemysław Gałęzki",
@@ -19,3 +19,4 @@ export * from "./sugar/omni.js"
19
19
 
20
20
  export * from "./utils/checksum.js"
21
21
  export * from "./utils/datafile.js"
22
+ export * from "./utils/anim.js"
@@ -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, resolveSpatialTransform} from '../../utils/anim.js'
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(resolveSpatialTransform(spatial, time))
104
+ const local = transformToMat6(resolveTransform(spatial, time))
105
105
  return mul6(local, parentMatrix)
106
106
  }
107
107
  }
@@ -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 resolveSpatialTransform =(
65
+ export const resolveTransform =(
66
66
  spatial: Item.Spatial | Item.AnimatedSpatial,
67
67
  time: number,
68
68
  ): Transform =>