Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CrossFadeEffect output oppsite as documentation? #956

Open
HO-COOH opened this issue Jun 4, 2024 · 0 comments
Open

CrossFadeEffect output oppsite as documentation? #956

HO-COOH opened this issue Jun 4, 2024 · 0 comments

Comments

@HO-COOH
Copy link

HO-COOH commented Jun 4, 2024

I have this code

    <Border Width="200" Height="200" Loaded="Border_Loaded"/>
        private void Border_Loaded(object sender, RoutedEventArgs e)
        {
            var color1 = new ColorSourceEffect()
            {
                Color = Windows.UI.Color.FromArgb(255, 255, 0, 0)
            };

            var color2 = new ColorSourceEffect()
            {
                Color = Windows.UI.Color.FromArgb(255, 0, 255, 0)
            };

            var crossFadeEffect = new CrossFadeEffect()
            {
                Source1 = color1,
                Source2 = color2,
                CrossFade = 0.0F
            };

            var host = sender as UIElement;
            var compositor = ElementCompositionPreview.GetElementVisual(host).Compositor;
            var brush = compositor.CreateEffectFactory(crossFadeEffect).CreateBrush();
            var visual = compositor.CreateSpriteVisual();
            visual.Size = host.ActualSize;
            visual.Brush = brush;
            ElementCompositionPreview.SetElementChildVisual(host, visual);
        }

So apparently according to doc,
image

when CrossFade=0, it should outputs color1, which is Red, but it shows me color2 instead. How is this possible?
image

Reproduce here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant