// ==================== // SATURATE // ==================== internal static void SaturateTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => animGroup.CreateEffectAnimation <SaturateAnimation, double>( element, settings, to: settings.Saturation)); }
// ==================== // TINT // ==================== internal static void TintTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => animGroup.CreateEffectAnimation <TintAnimation, Color>( element, settings, to: settings.Tint)); }
internal static void ScaleYTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => animGroup.CreateScalarAnimation <ScaleYAnimation>( element, settings, to: (float)settings.ScaleY)); }
// ==================== // ROTATE // ==================== internal static void RotateTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => animGroup.CreateScalarAnimation <RotateAnimation>( element, settings, to: settings.Rotation)); }
internal static void SwivelYTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => animGroup.CreatePerspectiveAnimation <SwivelYAnimation>( element, settings, to: settings.SwivelY)); }
internal static void TranslateZTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => animGroup.CreateScalarAnimation <TranslateZAnimation>( element, settings, to: (float)settings.OffsetZ)); }
internal static void TranslateYTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => animGroup.CreateScalarAnimation <TranslateYAnimation>( element, settings, to: settings.OffsetY.GetCalculatedOffset(element, OffsetTarget.Y))); }
// ==================== // BLUR // ==================== internal static void BlurTo(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => animGroup.CreateEffectAnimation <BlurAnimation, double>( element, settings, to: settings.BlurRadius)); }
internal static void FadeFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { ElementCompositionPreview.GetElementVisual(element).Opacity = (float)settings.Opacity; return(animGroup.CreateScalarAnimation <FadeAnimation>( element, settings, to: 1)); }); }
internal static void RotateFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { var visual = ElementCompositionPreview.GetElementVisual(element); visual.RotationAngleInDegrees = (float)settings.Rotation; return(animGroup.CreateScalarAnimation <RotateAnimation>( element, settings, to: 0)); }); }
internal static void ScaleZFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { var visual = ElementCompositionPreview.GetElementVisual(element); visual.Scale = new Vector3(visual.Scale.X, visual.Scale.Y, (float)settings.ScaleZ); return(animGroup.CreateScalarAnimation <ScaleZAnimation>( element, settings, to: 1f)); }); }
internal static void TintFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { animGroup.CreateEffectAnimation <TintAnimation, Color>( element, settings, to: settings.Tint, duration: 1, isFrom: true); return(animGroup.CreateEffectAnimation <TintAnimation, Color>( element, settings, to: AnimationSettings.DEFAULT_TINT)); }); }
internal static void SaturateFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { animGroup.CreateEffectAnimation <SaturateAnimation, double>( element, settings, to: settings.Saturation, duration: 1, isFrom: true); return(animGroup.CreateEffectAnimation <SaturateAnimation, double>( element, settings, to: AnimationSettings.DEFAULT_SATURATION)); }); }
internal static void BlurFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { animGroup.CreateEffectAnimation <BlurAnimation, double>( element, settings, to: settings.BlurRadius, duration: 1, isFrom: true); return(animGroup.CreateEffectAnimation <BlurAnimation, double>( element, settings, to: 0)); }); }
internal static void FadeFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { animGroup.CreateScalarAnimation <FadeAnimation>( element, settings, to: settings.Opacity, duration: 1, isFrom: true); return(animGroup.CreateScalarAnimation <FadeAnimation>( element, settings, to: 1)); }); }
internal static void TranslateXFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { animGroup.CreateScalarAnimation <TranslateXAnimation>( element, settings, to: (float)settings.OffsetX, duration: 1, isFrom: true); return(animGroup.CreateScalarAnimation <TranslateXAnimation>( element, settings, to: 0f)); }); }
internal static void ScaleZFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { animGroup.CreateScalarAnimation <ScaleZAnimation>( element, settings, to: (float)settings.ScaleZ, duration: 1, isFrom: true); return(animGroup.CreateScalarAnimation <ScaleZAnimation>( element, settings, to: 1f)); }); }
internal static void SwivelYFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { var visual = ElementCompositionPreview.GetElementVisual(element); animGroup.CreatePerspectiveAnimation <SwivelYAnimation>( element, settings, to: settings.SwivelY, duration: 1, isFrom: true); return(animGroup.CreatePerspectiveAnimation <SwivelYAnimation>( element, settings, to: 0)); }); }
internal static void TranslateXFrom(this FrameworkElement element, AnimationSettings settings, ref AnimationGroup group) { group.CreateAnimations(element, settings, animGroup => { var visual = ElementCompositionPreview.GetElementVisual(element); // Since Translation doesn't exist as a property on Visual, we try to fetch it from the PropertySet if (visual.Properties.TryGetVector3(TargetProperties.Translation, out var translation) == CompositionGetValueStatus.Succeeded) { visual.Properties.InsertVector3(TargetProperties.Translation, new Vector3((float)settings.OffsetX.GetCalculatedOffset(element, OffsetTarget.X), translation.Y, translation.Z)); } else { visual.Properties.InsertVector3(TargetProperties.Translation, new Vector3((float)settings.OffsetX.GetCalculatedOffset(element, OffsetTarget.X), 0f, 0f)); } return(animGroup.CreateScalarAnimation <TranslateXAnimation>( element, settings, to: 0f)); }); }