From 2ea5b4209288829a56a958d7cc46f2a851af1acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=C3=AF=7E?= Date: Tue, 8 Mar 2022 07:14:17 +0100 Subject: [PATCH] Add AacFlSettingCurve.WithAnimationCurve(...) to animate using traditional AnimationCurve objects: - Add WithAnimationCurve to animate using traditional AnimationCurve objects --- Framework/Editor/V0/AacFlAnimations.cs | 8 ++++++++ README.md | 1 + 2 files changed, 9 insertions(+) diff --git a/Framework/Editor/V0/AacFlAnimations.cs b/Framework/Editor/V0/AacFlAnimations.cs index b4c2627..d6113e2 100644 --- a/Framework/Editor/V0/AacFlAnimations.cs +++ b/Framework/Editor/V0/AacFlAnimations.cs @@ -290,6 +290,14 @@ namespace AnimatorAsCode.V0 AnimationUtility.SetEditorCurve(_clip, binding, new AnimationCurve(mutatedKeyframes.ToArray())); } } + + public void WithAnimationCurve(AnimationCurve animationCurve) + { + foreach (var binding in _bindings) + { + AnimationUtility.SetEditorCurve(_clip, binding, animationCurve); + } + } } public class AacFlSettingCurveColor diff --git a/README.md b/README.md index 33944ee..7dca04a 100644 --- a/README.md +++ b/README.md @@ -747,6 +747,7 @@ foreach (var cancelWhenNotAllowed in new[] {auto, reverse, manual, custom, done} - `void WithSecondsUnit(Action action)` /// Start defining the keyframes with a lambda expression, expressing the unit to be in seconds. - `void WithFrameCountUnit(Action action)` /// Start defining the keyframes with a lambda expression, expressing the unit in frames. - `void WithUnit(AacFlUnit unit, Action action)` /// Start defining the keyframes with a lambda expression, expressing the unit. +- `void WithAnimationCurve(AnimationCurve animationCurve)` /// Define the curve using a traditional AnimationCurve. # Curve of type Color (AacFlSettingCurveColor)