当前位置: 首页>>代码示例>>C#>>正文


C# Canvas.ToAnimatedOpacity方法代码示例

本文整理汇总了C#中System.Windows.Controls.Canvas.ToAnimatedOpacity方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.ToAnimatedOpacity方法的具体用法?C# Canvas.ToAnimatedOpacity怎么用?C# Canvas.ToAnimatedOpacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.Canvas的用法示例。


在下文中一共展示了Canvas.ToAnimatedOpacity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OrcasAvalonApplicationCanvas

        public OrcasAvalonApplicationCanvas()
        {
            Width = DefaultWidth;
            Height = DefaultHeight;
            //Background = 0xffc0c0c0.ToSolidColorBrush();
            Background = Brushes.Black;

            var InfoOverlay = new Canvas
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
            };


            var InfoOverlayShadow = new Rectangle
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
                Fill = Brushes.Black
            }.AttachTo(InfoOverlay);

            var InfoOverlayShadowOpacity = InfoOverlay.ToAnimatedOpacity();
            InfoOverlayShadowOpacity.Opacity = 1;

            var InfoOverlayText = new TextBox
            {
                AcceptsReturn = true,
                IsReadOnly = true,
                Background = Brushes.Transparent,
                BorderThickness = new Thickness(0),
                Width = DefaultWidth,
                Height = 180,
                TextAlignment = TextAlignment.Center,
                FontSize = 30,
                Foreground = Brushes.White,
                Text = "The winner is\n the first player\n to get an unbroken row\n of five stones",
                FontFamily = new FontFamily("Verdana")

            }.MoveTo(0, (DefaultHeight - 180) / 2).AttachTo(InfoOverlay);



            var TouchOverlay = new Canvas
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
                Background = Brushes.Yellow,
                Opacity = 0,
            };



            var Tiles = new Tile[Intersections * Intersections];

            #region WhereUnderAttack
            Func<int, int, IEnumerable<Tile>> WhereUnderAttack =
                (length, value) =>
                    Tiles.Where(
                        k =>
                        {
                            if (k.Value != 0)
                                return false;


                            return k.IsUnderAttack(value, length);
                        }
                    );
            #endregion

            #region AI
            Action AI =
                delegate
                {
                    // defensive rule:

                    var AttackWith4 = WhereUnderAttack(4, -1).FirstOrDefault();
                    if (AttackWith4 != null)
                    {
                        Console.WriteLine("AttackWith4");
                        AttackWith4.Value = -1;
                        return;
                    }

                    var AttackedBy4 = WhereUnderAttack(4, 1).FirstOrDefault();
                    if (AttackedBy4 != null)
                    {
                        Console.WriteLine("AttackedBy4");
                        AttackedBy4.Value = -1;
                        return;
                    }

                    var AttackWith3 = WhereUnderAttack(3, -1).FirstOrDefault();
                    if (AttackWith3 != null)
                    {
                        Console.WriteLine("AttackWith3");
                        AttackWith3.Value = -1;
                        return;
                    }

                    var AttackedBy3 = WhereUnderAttack(3, 1).FirstOrDefault();
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:OrcasAvalonApplicationCanvas.cs

示例2: OrcasAvalonApplicationCanvas

        public OrcasAvalonApplicationCanvas()
        {
            Width = DefaultWidth;
            Height = DefaultHeight;

            this.ClipToBounds = true;

            var x = GameReferenceExtensions.Default;

            var Content = new Canvas
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
            }.AttachTo(this);

            int LogoSize = 32;

            new Image
            {
                Width = LogoSize,
                Height = LogoSize,
                Source = ("assets/Bulldog.Promotion/jsc.png").ToSource()
            }.MoveTo(DefaultWidth - LogoSize, DefaultHeight - LogoSize).AttachTo(this);

            var TouchOverlayContainer = new Canvas
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
            }.AttachTo(this);

            var wc = new WebClient();

            var List = new List<Entry>();

            #region load
            wc.DownloadStringCompleted +=
                (sender, args) =>
                {

                    var a = GameReferenceExtensions.Partial;

                    a.ForEach(k => k.Source = k.Image.Substring(GameReferenceExtensions.Host.Length + 1));

                    if (args.Error == null)
                        a = a.FromYAML(args.Result);

                    this.Dispatcher.Invoke(
                        (Action)
                        delegate
                        {
                            var i = 0;
                            foreach (var k_ in a)
                            {
                                var k = k_;

                                var Container = new Canvas
                                {
                                    Width = GameReferenceExtensions.Width,
                                    Height = GameReferenceExtensions.Height,
                                }.AttachTo(Content).MoveTo(0, i * GameReferenceExtensions.Height);

                                var Image = new Image
                                {
                                    Width = GameReferenceExtensions.Width,
                                    Height = GameReferenceExtensions.Height,

                                    Stretch = Stretch.Fill
                                }.AttachTo(Container);

                                var Shadow = new Rectangle
                                {
                                    Fill = Brushes.Black,
                                    Opacity = 0.5,
                                    Width = GameReferenceExtensions.Width - 2 * 2,
                                    Height = GameReferenceExtensions.Height / 3,

                                }.AttachTo(Container).MoveTo(2, GameReferenceExtensions.Height / 3);

                                var ShadowBottom = new Rectangle
                                {
                                    Fill = Brushes.Black,
                                    Width = GameReferenceExtensions.Width - 2 * 2,
                                    Height = GameReferenceExtensions.Height / 3 / 2,
                                }.AttachTo(Container).MoveTo(2, GameReferenceExtensions.Height / 3 + GameReferenceExtensions.Height / 3 / 2);

                                var AnimatedShadow = Shadow.ToAnimatedOpacity();
                                AnimatedShadow.Opacity = 0;

                                var AnimatedShadowBottom = ShadowBottom.ToAnimatedOpacity();
                                AnimatedShadowBottom.Opacity = 0;

                                var Text = new TextBox
                                {
                                    BorderThickness = new Thickness(0),
                                    Width = GameReferenceExtensions.Width * 2,
                                    Background = Brushes.Transparent,
                                    Foreground = Brushes.White,
                                    IsReadOnly = true,
                                    Text = k.Title,
                                    TextAlignment = TextAlignment.Center,
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zproxygames-svn-to-git,代码行数:101,代码来源:OrcasAvalonApplicationCanvas.cs

示例3: XInitialize

        private void XInitialize()
        {

            //this.Background = Brushes.Black;
            this.Background = Brushes.White;

            var b = new JSCSolutionsNETCarouselCanvas();

            b.CloseOnClick = false;
            b.Container.AttachTo(this);

            var bg_black = new Canvas
            {
                Background = Brushes.Black
            }.AttachTo(this);

            var bg_black_opacity = bg_black.ToAnimatedOpacity();

            bg_black_opacity.Opacity = 0;

            var w = new JSCSolutionsNETWhiteCarouselCanvas();

            w.CloseOnClick = false;
            w.Container.AttachTo(bg_black);

            bool OtherView = false;

            //new { b.step }.With(
            //    x =>
            //    {
            //        var counter = 0;

            //        (1000 / 60).AtIntervalWithTimer(
            //            speedboost =>
            //            {
            //                counter++;

            //                b.step = x.step * (1 + counter * 0.1);

            //                if (counter == 60 * 2)
            //                    speedboost.Stop();

            //            }
            //        );

            //    }
            //);



            Action ChooseView =
                delegate
                {

                    //V:\web\AvalonBrowserLogos\ApplicationCanvas___c__DisplayClass5.as(35): col: 36 Error: Implicit coercion of a value of type Boolean to an unrelated type Number.

                    //            if (!(((this.__4__this.Width > this.__4__this.Height) ^ this.OtherView) == 0))
                    //                                   ^

                    //V:\web\AvalonBrowserLogos\ApplicationCanvas___c__DisplayClass5.as(35): col: 74 Error: Implicit coercion of a value of type Boolean to an unrelated type Number.

                    //            if (!(((this.__4__this.Width > this.__4__this.Height) ^ this.OtherView) == 0))
                    //                                                                         ^


                    // X:\jsc.svn\examples\actionscript\Test\TestBooleanXor\TestBooleanXor\Class1.cs
                    // actionscript thinks this operator results in int?
                    //var flag = (Width > Height) ^ OtherView;
                    var flag = (Width > Height);

                    if (OtherView)
                        flag = !flag;

                    if (flag)
                        bg_black_opacity.Opacity = 0;
                    else
                        bg_black_opacity.Opacity = 1;
                };

            w.AtLogoClick +=
                delegate
                {
                    OtherView = !OtherView;

                    ChooseView();
                };

            b.AtLogoClick +=
                delegate
                {
                    OtherView = !OtherView;

                    ChooseView();

                };

            this.SizeChanged += (s, e) =>
            {
                ChooseView();

//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationCanvas.cs

示例4: CreateWindow

        public void CreateWindow(Position WindowLocation, Action<WindowInfo> Yield = null)
        {
            var GlassArea = new Canvas();

            GlassArea.AttachTo(this);
            GlassArea.MoveTo(WindowLocation.Left, WindowLocation.Top);
            GlassArea.SizeTo(WindowLocation.Width, WindowLocation.Height);
            GlassArea.ClipToBounds = true;

            for (int i = 0; i < WindowLocation.Width; i += 456)
                for (int j = 0; j < WindowLocation.Height; j += 696)
                {
                    var i2 = new Avalon.Images.s_bg().SizeTo(456, 696);

                    i2.MoveTo(i, j);
                    i2.Opacity = 0.8;

                    i2.AttachTo(GlassArea);
                }

            var GlassOpacity = GlassArea.ToAnimatedOpacity();

            GlassOpacity.Opacity = 1;
            var w = new WindowInfo { GlassArea = GlassArea, GlassOpacity = GlassOpacity, WindowLocation = WindowLocation };


            var Left = new Avalon.Images.s_l
            {
                Stretch = Stretch.Fill
            }
            .AttachTo(this);


            var Top = new Avalon.Images.s_t
            {
                Stretch = Stretch.Fill
            }
            .AttachTo(this);




            var Right = new Avalon.Images.s_r
            {
                Stretch = Stretch.Fill
            }.AttachTo(this);




            var Bottom = new Avalon.Images.s_b
            {
                Stretch = Stretch.Fill
            }
             .AttachTo(this);


            var TopLeft = new Avalon.Images.s_tl
            {
                Stretch = Stretch.Fill
            }
           .AttachTo(this);


            var BottomRight = new Avalon.Images.s_br
            {
                Stretch = Stretch.Fill
            }
             .AttachTo(this);



            var TopRight = new Avalon.Images.s_tr
            {
                Stretch = Stretch.Fill
            }
           .AttachTo(this);


            var BottomLeft = new Avalon.Images.s_bl
            {
                Stretch = Stretch.Fill
            }
           .AttachTo(this);


            w.WindowLocationChanged +=
               delegate
               {
                   Left.MoveTo(WindowLocation.Left - 16, WindowLocation.Top + 6)
                   .SizeTo(16, WindowLocation.Height - 6 - 4);

                   Top.MoveTo(WindowLocation.Left + 6, WindowLocation.Top - 16)
          .SizeTo(WindowLocation.Width - 6 - 4, 22);

                   Right.MoveTo(WindowLocation.Left + WindowLocation.Width, WindowLocation.Top + 6)
               .SizeTo(20, WindowLocation.Height - 4 - 6);


                   Bottom.MoveTo(WindowLocation.Left + 5, WindowLocation.Top + WindowLocation.Height)
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationCanvas.cs


注:本文中的System.Windows.Controls.Canvas.ToAnimatedOpacity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。