Views/Animation2.xaml.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MahAppsMetro.Demo.Views
{
    /// <summary>
    /// Animation2.xaml 的互動邏輯
    /// </summary>
    public partial class Animation2 : UserControl
    {
        public Animation2()
        {
            InitializeComponent();
            Loaded += Animation2_Loaded;
        }

        public new bool IsLoaded { get; set; }
        private void Animation2_Loaded(object sender, RoutedEventArgs e)
        {
            if (IsLoaded) return;
            IsLoaded = true;
            Play();
            PlayPanel1();
        }

        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            Play();
        }

        private void Play()
        {
            ThicknessAnimationUsingKeyFrames thicknessAnimation = new ThicknessAnimationUsingKeyFrames()
            {
                Duration = TimeSpan.FromSeconds(6),
                RepeatBehavior = RepeatBehavior.Forever,
            };
            thicknessAnimation.KeyFrames.Add(new LinearThicknessKeyFrame(new Thickness(0, 20, 0, 0), KeyTime.FromTimeSpan(TimeSpan.FromSeconds(4))));
            thicknessAnimation.KeyFrames.Add(new LinearThicknessKeyFrame(new Thickness(0, 20, 0, 0), KeyTime.FromTimeSpan(TimeSpan.FromSeconds(5))));
            thicknessAnimation.KeyFrames.Add(new LinearThicknessKeyFrame(new Thickness(0, 100, 0, 0), KeyTime.FromTimeSpan(TimeSpan.FromSeconds(5.5))));
            this.tbName.BeginAnimation(TextBlock.MarginProperty, thicknessAnimation);
        }

        void PlayPanel1()
        {
            int time = 1;
            for (int i = 0; i < panel1.Children.Count; i++)
            {
后面还有 14 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。