Skip to content

Commit

Permalink
Don't apply id keyframes when mix value is 0
Browse files Browse the repository at this point in the history
Addresses an issue where mixing animations of a nested artboard from it's parent artboard can produce unexpected results when dealing with id based keyframes (such as active solo or draw rules). The proposed solution ignores applying an id keyframe's value to an object if the mix value for that animation/keyframe is 0. This provides a way to turn "off" an id based keyframe during a mix.

Behavior AFTER this update. This example has an artboard with 2 animations that each have different values for active solo and a draw rule that is on or off. This artboard is nested in another artboard which sets the animation mix as seen in the recording.

https://github.com/rive-app/rive/assets/186340/b67e98c8-ab7c-4a92-ab3b-65d27b0eadbd

Behavior BEFORE:

https://github.com/rive-app/rive/assets/186340/c0a6c558-efc4-43ec-8974-57bf8f6ab3e8

Diffs=
b9382846d Don't apply id keyframes when mix value is 0 (#5960)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
  • Loading branch information
philter and philter committed Sep 12, 2023
1 parent bc7a03a commit d76d2a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f96c86fcc800a1fa2bec3e97be00cab395ea838d
b9382846d3152fd87ee8ffc8e7a86ea2b5933a9b
8 changes: 6 additions & 2 deletions src/animation/keyframe_id.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ using namespace rive;

void KeyFrameId::apply(Core* object, int propertyKey, float mix)
{
CoreRegistry::setUint(object, propertyKey, value());
if (mix > 0) {
CoreRegistry::setUint(object, propertyKey, value());
}
}

void KeyFrameId::applyInterpolation(Core* object,
Expand All @@ -14,5 +16,7 @@ void KeyFrameId::applyInterpolation(Core* object,
const KeyFrame* nextFrame,
float mix)
{
CoreRegistry::setUint(object, propertyKey, value());
if (mix > 0) {
CoreRegistry::setUint(object, propertyKey, value());
}
}
8 changes: 6 additions & 2 deletions src/animation/keyframe_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ using namespace rive;

void KeyFrameString::apply(Core* object, int propertyKey, float mix)
{
CoreRegistry::setString(object, propertyKey, value());
if (mix > 0) {
CoreRegistry::setString(object, propertyKey, value());
}
}

void KeyFrameString::applyInterpolation(Core* object,
Expand All @@ -14,5 +16,7 @@ void KeyFrameString::applyInterpolation(Core* object,
const KeyFrame* nextFrame,
float mix)
{
CoreRegistry::setString(object, propertyKey, value());
if (mix > 0) {
CoreRegistry::setString(object, propertyKey, value());
}
}

0 comments on commit d76d2a8

Please sign in to comment.