MCPcopy Create free account
hub / github.com/Effect-TS/effect / update

Function update

packages/ui/native/src/kit/Animation.ts:1308–1340  ·  view source on GitHub ↗
(
  d: Driver,
  e: Entry,
  spec: Spec,
  outer: RegExp | undefined
)

Source from the content-addressed store, hash-verified

1306}
1307
1308const update = (
1309 d: Driver,
1310 e: Entry,
1311 spec: Spec,
1312 outer: RegExp | undefined
1313) => {
1314 e.built = spec
1315 const shape = shapeOf(spec)
1316 if (shape !== e.shape || outer !== e.outer) {
1317 e.shape = shape
1318 e.outer = outer
1319 rebuild(d, e, spec, outer)
1320 }
1321 let changed = false
1322 leaves(spec, (path, value, layer) => {
1323 const target = e.targets.get(path)
1324 if (target === undefined || target.to === value) return
1325 changed = true
1326 go(
1327 d,
1328 e,
1329 target,
1330 value as number,
1331 layer.transition ?? (fallback ??= timing())
1332 )
1333 })
1334 // An immediate change ends at once. Report it after the commit.
1335 if (changed && idle(e)) {
1336 Promise.resolve().then(() => {
1337 if (e.graph !== undefined && idle(e)) settle(e)
1338 })
1339 }
1340}
1341
1342// Replaces the graph, keeping the targets that are still numeric leaves and
1343// their running animations.

Callers 2

flushFunction · 0.70
viewTransitionFunction · 0.50

Calls 9

shapeOfFunction · 0.85
timingFunction · 0.85
resolveMethod · 0.80
rebuildFunction · 0.70
leavesFunction · 0.70
goFunction · 0.70
idleFunction · 0.70
settleFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected