【发布时间】:2019-10-30 10:50:12
【问题描述】:
我希望在单击按钮后出现一个动画并落在图片上,该图片是 _random 的编号,但我在 google 上找不到任何东西
我尝试谷歌并四处询问,但仍然没有得到我想要的东西
public sealed partial class FilePage : Page
{
DataPage value = new DataPage();
Random _random = new Random();
private int time = 0;
DispatcherTimer Timer;
public FilePage()
{
this.InitializeComponent();
}
private void ButtonClick1(object sender, RoutedEventArgs e)
{
//////////
//////////cut some off to keep this short (turning the border black again)
//////////
Timer = new DispatcherTimer();
Timer.Interval = new TimeSpan(0, 0, 3);
Timer.Tick += Timer_Tick;
Timer.Start();
}
public void Timer_Tick(object sender, object e)
{
int value = _random.Next(1, 13);
((Grid)gMainGrid.FindName($"g{value}")).BorderBrush = new SolidColorBrush(Colors.White);
Timer.Stop();
SpinnerSecond.Visibility = Visibility.Collapsed;
DataWatch.valueWatch = value;
RollKnop.Visibility = Visibility.Visible;
}
}
}
所以我想要一个像这样跨越边界的动画: https://docs.microsoft.com/en-us/windows/apps/images/fluent/traveling-focus-fullscreen-light-rf.gif 3 秒钟然后降落在正确的位置,如果我听起来像一个需求者,我很抱歉,但我已经在谷歌上搜索了 2 天
【问题讨论】:
-
13 张图片,窗口上有 1 个按钮
标签: c# loops animation uwp border