Instantiator(Wc.Compositor compositor) { _c = compositor; #if ReuseExpressionAnimation _expressionAnimation = _c.CreateExpressionAnimation(); #endif }
/// <summary> /// 毛玻璃注入灵魂 /// </summary> /// <param name="glassHost"></param> private void InitializeFrostedGlass(UIElement glassHost) { Visual hostVisual = ElementCompositionPreview.GetElementVisual(glassHost); Compositor compositor = hostVisual.Compositor; Windows.UI.Composition.CompositionBackdropBrush backdropBrush = compositor.CreateHostBackdropBrush(); Windows.UI.Composition.SpriteVisual glassVisual = compositor.CreateSpriteVisual(); glassVisual.Brush = backdropBrush; ElementCompositionPreview.SetElementChildVisual(glassHost, glassVisual); Windows.UI.Composition.ExpressionAnimation bindSizeAnimation = compositor.CreateExpressionAnimation("hostVisual.Size"); bindSizeAnimation.SetReferenceParameter("hostVisual", hostVisual); glassVisual.StartAnimation("Size", bindSizeAnimation); }
/// <summary> /// Internal constructor for a target <see cref="ExpressionAnimation"/> /// </summary> /// <param name="animation">The <see cref="ExpressionAnimation"/> that will be played</param> /// <param name="propertySet">The <see cref="CompositionPropertySet"/> with the custom parameter</param> /// <param name="parameterName">The name of the custom parameter that will be updated when requested</param> internal ScalarExpressionAnimation(ExpressionAnimation animation, CompositionPropertySet propertySet, string parameterName) { Animation = animation; PropertySet = propertySet; ParameterName = parameterName; }
/// <summary> /// Internal constructor for a target <see cref="ExpressionAnimation"/> /// </summary> /// <param name="animation">The <see cref="ExpressionAnimation"/> that will be played</param> /// <param name="propertySet">The <see cref="CompositionPropertySet"/> with the custom parameter</param> /// <param name="parameterName">The name of the custom parameter that will be updated when requested</param> internal ScalarExpressionAnimation([NotNull] ExpressionAnimation animation, [NotNull] CompositionPropertySet propertySet, [NotNull] string parameterName) { Animation = animation; PropertySet = propertySet; ParameterName = parameterName; }