Event fixes

Addresses issues brought up here:
https://2dimensions.slack.com/archives/CLLCU09T6/p1694766559770229

- Custom properties not updating when expected.
- Events not firing on first frame.

One important aspect of all of this:
- Custom properties on events update with LinearAnimation.apply.
- Events on timelines and state machines accrue/report during StateMachine/LinearAnimation.advance

These could happen when the state machine would transition to a layer with an animation. The first frame would apply with mix 0 meaning all non-mixable properties wouldn't be applied per https://github.com/rive-app/rive/pull/5960/files.

I took a slightly different approach. Now apply will always try to apply values. If mix is 0, non mixing properties will apply. I think semantically this makes more sense too. If you don't want to apply, don't apply. Apply with mix 0 is effectively a no-op as we had it before, so it was just a perf suck.

So I re-worked the various call sites for apply to not call it when attempting to mix in an effectively mixed-out animation. This has one caveat for blend states. Because the blend state advances all the animations in sync, .advance must still be called when mix is 0, so events will still report but custom property keyframes in mixed out animations will not update. I think that's reasonable, but may not be immediately apparent. We can opt to not report events when the mix is 0 by introducing a "reportEvents" boolean to advance, or add an option to the blend state for whether or not they should report.

Diffs=
236d788ea Event fixes (#5997)
05e1afaf3 Bump the iOS minimum version to 13 on native builds (#5989)
0dcbdade4 add artboards shapes to updates when RenderOpacity has dirt (#5971)
85b2b6ed1 Read passed any empty runs when iterating glyphs. (#5974)

Co-authored-by: Alex Gibson <agibson.uk@gmail.com>
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
This commit is contained in:
luigi-rosso
2023-09-15 22:11:30 +00:00
parent e95a35f710
commit acdcb4ef2f
2 changed files with 3 additions and 11 deletions

View File

@ -1 +1 @@
b9382846d3152fd87ee8ffc8e7a86ea2b5933a9b
236d788ea3cf8f184a026a1b69c14af60003169c

View File

@ -9,21 +9,13 @@ class KeyFrameId extends KeyFrameIdBase {
@override
void apply(Core<CoreContext> object, int propertyKey, double mix) {
// If mix is 0, we don't apply this keyframe value. This rule allows
// "mixing" of id values which are usually on/off
if (mix > 0) {
RiveCoreContext.setUint(object, propertyKey, value);
}
RiveCoreContext.setUint(object, propertyKey, value);
}
@override
void applyInterpolation(Core<CoreContext> object, int propertyKey,
double currentTime, KeyFrameId nextFrame, double mix) {
// If mix is 0, we don't apply this keyframe value. This rule allows
// "mixing" of id values which are usually on/off
if (mix > 0) {
RiveCoreContext.setUint(object, propertyKey, value);
}
RiveCoreContext.setUint(object, propertyKey, value);
}
@override