/// <summary> /// Creates the actual animator instance /// </summary> private static IValueAnimator CreateDouble(Timeline timeline, double startingValue, double targetValue) { if (timeline.GetIsDurationZero()) { // Avoid unnecessary JS interop in the case of a zero-duration animation return(new ImmediateAnimator <double>(startingValue, targetValue)); } return(new RenderingLoopFloatAnimator((float)startingValue, (float)targetValue)); }
/// <summary> /// Creates the actual animator instance /// </summary> private static IValueAnimator CreateDouble(Timeline timeline, double startingValue, double targetValue) { if (timeline.GetIsDependantAnimation() || timeline.GetIsDurationZero()) { return(new NativeValueAnimatorAdapter(ValueAnimator.OfFloat((float)startingValue, (float)targetValue))); } else { return(timeline.GetGPUAnimator(startingValue, targetValue)); } }
private static IValueAnimator CreateColor(Timeline timeline, ColorOffset startingValue, ColorOffset targetValue) { if (timeline.GetIsDurationZero()) { // Avoid unnecessary JS interop in the case of a zero-duration animation return(new ImmediateAnimator <ColorOffset>(startingValue, targetValue)); } // TODO: GPU-bound color animations - https://github.com/unoplatform/uno/issues/2947 return(new RenderingLoopColorAnimator(startingValue, targetValue)); }
/// <summary> /// Gets a value indicating whether this instance is a dependant animation. /// /// https://msdn.microsoft.com/en-uS/office/office365/jj819807.aspx#dependent /// </summary> /// <value><c>true</c> if this instance is dependant animation; otherwise, <c>false</c>.</value> internal static bool GetIsDependantAnimation(this Timeline timeline) { if (timeline.GetIsDurationZero() || !timeline.IsTargetPropertyDependant()) { //is not dependant if the target is a transform or duration is zero return(false); } if (timeline.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) { timeline.Log().Debug("This Dependant animation will not run, EnableDependentAnimation is set to false"); } return(true); //is dependant }
/// <summary> /// Animation should be hardware-bound if it is neither dependent, nor zero-duration. /// </summary> internal static bool GetIsHardwareAnimated(this Timeline timeline) => !timeline.GetIsDependantAnimation() && !timeline.GetIsDurationZero();