コード例 #1
0
        public void PrepareTransition()
        {
            CoverGrid.GetVisual().Scale           = new System.Numerics.Vector3(1, 1, 1);
            TitlePanel.GetVisual().Offset         = new System.Numerics.Vector3(0, 0, 0);
            SubtitleTextBlock.GetVisual().Opacity = 1;

            ConnectedAnimationService.GetForCurrentView().PrepareToAnimate(ConnectedAnimationKeys.CoverTransition, CoverGrid);
            ConnectedAnimationService.GetForCurrentView().PrepareToAnimate(ConnectedAnimationKeys.TitleTransition, AccentTitleTextBlock);
            ConnectedAnimationService.GetForCurrentView().PrepareToAnimate(ConnectedAnimationKeys.SubtitleTransition, SubtitleTextBlock);
        }
コード例 #2
0
        private void SetupAnimations()
        {
            const float maxOffset = -16f;

            var scrollViewer    = SongsListView.FindDescendant <ScrollViewer>();
            var scrollerPropSet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scrollViewer);

            var coverVisual             = CoverGrid.GetVisual();
            var coverPanelVisual        = CoverPanel.GetVisual();
            var titlePanelVisual        = TitlePanel.GetVisual();
            var contrastTitleTextVisual = ContrastTitleTextBlock.GetVisual();
            var accentTitleTextVisual   = AccentTitleTextBlock.GetVisual();
            var subtitleTextVisual      = SubtitleTextBlock.GetVisual();

            var c = this.GetVisual().Compositor;
            var coverPanelCoordinateY = c.CreateExpressionAnimation("Clamp(scroller.Translation.Y * factor, -16, 0)");

            coverPanelCoordinateY.SetReferenceParameter("scroller", scrollerPropSet);
            coverPanelCoordinateY.SetScalarParameter("factor", 0.2f);
            coverPanelVisual.StartAnimation("Offset.Y", coverPanelCoordinateY);

            var scaleAlgorithm = "Clamp(1 - layer.Offset.Y / maxOffset, 0.4, 1)";
            var scaleAnim      = c.CreateExpressionAnimation(scaleAlgorithm);

            scaleAnim.SetReferenceParameter("layer", coverPanelVisual);
            scaleAnim.SetScalarParameter("maxOffset", maxOffset);
            coverVisual.StartAnimation("Scale.X", scaleAnim);
            coverVisual.StartAnimation("Scale.Y", scaleAnim);

            var titlePanelCoordinateXAnim = c.CreateExpressionAnimation("coverOriginWidth * (layer.Scale.X - 1.0)");

            titlePanelCoordinateXAnim.SetReferenceParameter("layer", coverVisual);
            titlePanelCoordinateXAnim.SetScalarParameter("coverOriginWidth", 76f);
            titlePanelVisual.StartAnimation("Offset.X", titlePanelCoordinateXAnim);

            var titlePanelCoordinateYAnim = c.CreateExpressionAnimation("layer.Offset.Y * 1.5");

            titlePanelCoordinateYAnim.SetReferenceParameter("layer", coverPanelVisual);
            titlePanelVisual.StartAnimation("Offset.Y", titlePanelCoordinateYAnim);

            //var titleTextColorAnim = c.CreateExpressionAnimation("layer.Offset.Y < maxOffset / 2 ? whiteColor : accentColor");
            //titleTextColorAnim.SetReferenceParameter("layer", coverPanelVisual);
            //titleTextColorAnim.SetScalarParameter("maxOffset", maxOffset);
            //titleTextColorAnim.SetColorParameter("whiteColor", Colors.White);
            //titleTextColorAnim.SetColorParameter("accentColor", ((SolidColorBrush)TitleTextBlock.Foreground).Color);

            var accentTitleOpacityAnim = c.CreateExpressionAnimation("1 - layer.Offset.Y / maxOffset");

            accentTitleOpacityAnim.SetReferenceParameter("layer", coverPanelVisual);
            accentTitleOpacityAnim.SetScalarParameter("maxOffset", maxOffset);
            accentTitleTextVisual.StartAnimation("Opacity", accentTitleOpacityAnim);

            var contrastTitleOpcityAnim = c.CreateExpressionAnimation("layer.Offset.Y / maxOffset");

            contrastTitleOpcityAnim.SetReferenceParameter("layer", coverPanelVisual);
            contrastTitleOpcityAnim.SetScalarParameter("maxOffset", maxOffset);
            contrastTitleTextVisual.StartAnimation("Opacity", contrastTitleOpcityAnim);

            var subtitleTextOpacityAnim = c.CreateExpressionAnimation("1 - layer.Offset.Y / maxOffset");

            subtitleTextOpacityAnim.SetReferenceParameter("layer", coverPanelVisual);
            subtitleTextOpacityAnim.SetScalarParameter("maxOffset", maxOffset);
            subtitleTextVisual.StartAnimation("Opacity", subtitleTextOpacityAnim);
        }
コード例 #3
0
 void RecalculateCell(IntVec3 cell, CoverGrid grid)
 {
     ArgArr[0] = cell;
     RecalculateCellMethod.Invoke(grid, ArgArr);
 }