@@ -462,7 +462,9 @@ class RenderAnimations extends RenderPose {
462462 void configure(NodeBox? box, Node n, {required bool animates, RenderMotion? motion, RenderShimmer? shimmer}) {
463463 _box = box;
464464 final previous = _node;
465+ final previousBase = _base;
465466 _node = n;
467+ _base = _patchesOwnPaths(n) && box != null ? box.tree.resolveUnanimated(box.id, instance: box.instance) ?? n : n;
466468 _motion = motion;
467469 _shimmer = shimmer;
468470 final wasAnimating = _animates;
@@ -503,7 +505,7 @@ class RenderAnimations extends RenderPose {
503505 for (final id in cues) {
504506 unawaited(play(id));
505507 }
506- if (previous != null && wasAnimating) _transition(previous, n );
508+ if (previous != null && wasAnimating) _transition(previousBase ?? previous, _base! );
507509 }
508510 _show();
509511 _sync();
@@ -894,6 +896,22 @@ class RenderAnimations extends RenderPose {
894896 Map<String, Map<String, Object?>> _lastPatches = const {};
895897 Map<String, Object?> _lastState = const {};
896898
899+ /// The node without what its own tracks patch into it (a path that is
900+ /// not its motion, opacity or shimmer): what an omitted end and a
901+ /// transition read. [_node] itself when nothing is patched.
902+ Node? _base;
903+
904+ /// Whether [n]'s own tracks or transitions are on paths the player
905+ /// patches into the node ([RenderTree.setAnimatedValues]).
906+ static bool _patchesOwnPaths(Node n) {
907+ bool patched(String path) =>
908+ path.isNotEmpty && path != 'opacity' && path != 'shimmer.position' && !path.startsWith('motion') && path != '*';
909+ for (final a in n.behaviors.animations) {
910+ if (a.tracks.any((t) => t.node.isEmpty && t.variable.isEmpty && patched(t.path))) return true;
911+ }
912+ return n.behaviors.transitions.any((t) => patched(t.property));
913+ }
914+
897915 /// The controller value of [clock] to draw with: its own in a running
898916 /// app; on a design canvas its `previewAt` (null: not drawn).
899917 double? _drawn(AnimationClock clock) {
@@ -997,7 +1015,7 @@ class RenderAnimations extends RenderPose {
9971015 if (t.node.isEmpty && eased(path)) continue;
9981016 // Any other path: a patch of the node (or of node [t.node]).
9991017 final target = t.node.isEmpty ? n.id : t.node;
1000- final value = t.valueAt(v, own: _ownValue(target, path), begin: _resolved(t.from), end: _resolved(t.to));
1018+ final value = t.valueAt(v, own: _resolved( _ownValue(target, path) ), begin: _resolved(t.from), end: _resolved(t.to));
10011019 if (value != null) (patches[target] ??= {})[path] = value;
10021020 }
10031021 if (dx != 0 || dy != 0 || sc != 1 || sx != 1 || sy != 1 || rot != 0) {
@@ -1034,9 +1052,10 @@ class RenderAnimations extends RenderPose {
10341052 _publish();
10351053 }
10361054
1037- /// The node's own [path] value as stored (an omitted `from` or `to`).
1055+ /// The node's own [path] value as stored (an omitted `from` or `to`), its
1056+ /// declared default where the JSON omits it.
10381057 Object? _ownValue(String id, String path, {Node? node}) {
1039- node ??= id == _node?.id ? _node : _box?.nodeOf(id);
1058+ node ??= id == _node?.id ? (_base ?? _node) : _box?.nodeOf(id);
10401059 if (node == null) return null;
10411060 Object? at = node.toJson();
10421061 for (final k in api.BindPaths.parse(path)) {
@@ -1049,7 +1068,8 @@ class RenderAnimations extends RenderPose {
10491068 at = api.readMap(at)?[k];
10501069 }
10511070 }
1052- return at;
1071+ // Omitted from its JSON: the field's declared default.
1072+ return at ?? api.BindPaths.declaredDefault(node, path);
10531073 }
10541074
10551075 Object? _resolved(Object? v) => v is String && v.contains(r'${') ? _number(v) ?? (_values?.interpolate(v)) : v;
0 commit comments