使用Windows.UI.Composition生成其他效果中的效果属性

时间:2016-08-17 17:09:26

标签: c# xaml animation uwp

我目前正在尝试使用Windows.UI.Composition为BlendEffect内的CompositeEffect的Source属性内部设置Lights。这是我的代码:

       var graphicsEffect = new BlendEffect
        {
            Mode = BlendEffectMode.Multiply,
            Background = new CompositeEffect()
            {
                Name = "comp",
                Mode = Microsoft.Graphics.Canvas.CanvasComposite.Add,
                Sources =
                {
                    new PointDiffuseEffect()
                    {
                        Name = "Light1",
                        DiffuseAmount = 1f,
                    },
                    new PointDiffuseEffect()
                    {
                        Name = "Light2",
                        DiffuseAmount = 1f,
                    },
                },
            },

            Foreground = new GaussianBlurEffect()
            {
                Name = "Blur",
                Source = new CompositionEffectSourceParameter("Backdrop"),
                BlurAmount = 12f,
                BorderMode = EffectBorderMode.Hard,
            }
        };

问题在于,当我尝试为这些灯光的位置或颜色设置动画时,我被告知“Animate属性指的是不在图形中的效果”。这甚至可能吗?如果没有,会有什么样的解决方法?我尝试过调用Light1.Lightpositioncomp.Light1.Lightpositioncomp.Sources.Light1.Lightposition,但这些都没有。