update:跳远动画
This commit is contained in:
parent
ba381d50bc
commit
8ae8397bb2
@ -23,8 +23,9 @@
|
|||||||
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="1242,301,0,0" Height="438" Width="360"/>
|
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="1242,301,0,0" Height="438" Width="360"/>
|
||||||
<Image
|
<Image
|
||||||
x:Name="centerImg4"
|
x:Name="centerImg4"
|
||||||
|
Visibility="Hidden"
|
||||||
gif:ImageBehavior.AnimatedSource="/Resources/Img/test_img/jump_long/jumping.gif"
|
gif:ImageBehavior.AnimatedSource="/Resources/Img/test_img/jump_long/jumping.gif"
|
||||||
gif:ImageBehavior.RepeatBehavior="Forever"
|
gif:ImageBehavior.RepeatBehavior="0"
|
||||||
gif:ImageBehavior.AnimateInDesignMode="True"
|
gif:ImageBehavior.AnimateInDesignMode="True"
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="824,72,0,0" Width="824" Height="610"/>
|
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="824,72,0,0" Width="824" Height="610"/>
|
||||||
<Grid Width="1920" Height="1080" Background="#80000000" x:Name="TipBox" Opacity="0">
|
<Grid Width="1920" Height="1080" Background="#80000000" x:Name="TipBox" Opacity="0">
|
||||||
|
|||||||
@ -22,6 +22,7 @@ using Wpf_AiSportsMicrospace.Common;
|
|||||||
using Wpf_AiSportsMicrospace.Enum;
|
using Wpf_AiSportsMicrospace.Enum;
|
||||||
using Wpf_AiSportsMicrospace.MyUserControl;
|
using Wpf_AiSportsMicrospace.MyUserControl;
|
||||||
using Wpf_AiSportsMicrospace.Views;
|
using Wpf_AiSportsMicrospace.Views;
|
||||||
|
using WpfAnimatedGif;
|
||||||
using Yztob.AiSports.Inferences.Abstractions;
|
using Yztob.AiSports.Inferences.Abstractions;
|
||||||
using Yztob.AiSports.Inferences.Implement;
|
using Yztob.AiSports.Inferences.Implement;
|
||||||
using Yztob.AiSports.Inferences.Things;
|
using Yztob.AiSports.Inferences.Things;
|
||||||
@ -107,7 +108,7 @@ namespace Views.JumpLong
|
|||||||
int rightWaving = DetectRightHandRaise(humans);
|
int rightWaving = DetectRightHandRaise(humans);
|
||||||
if (rightWaving >= 3 && _sportType == 0) //举手完成 开始跳远检测
|
if (rightWaving >= 3 && _sportType == 0) //举手完成 开始跳远检测
|
||||||
{
|
{
|
||||||
Utils.PlayBackgroundMusic("countdown_3.mp3", false);
|
|
||||||
_sportType = 1;
|
_sportType = 1;
|
||||||
StartSport();
|
StartSport();
|
||||||
}
|
}
|
||||||
@ -207,13 +208,18 @@ namespace Views.JumpLong
|
|||||||
private void OnSportTick(int counts, int times)
|
private void OnSportTick(int counts, int times)
|
||||||
{
|
{
|
||||||
var ts = TimeSpan.FromSeconds(times);
|
var ts = TimeSpan.FromSeconds(times);
|
||||||
_ = Dispatcher.BeginInvoke(() =>
|
_ = Dispatcher.BeginInvoke(async () =>
|
||||||
{
|
{
|
||||||
//sportCounts.Content = _sport.GetFormatCounts(); //counts.ToString();
|
//sportCounts.Content = _sport.GetFormatCounts(); //counts.ToString();
|
||||||
//sportTimes.Content = _sport.GetFormatTimes();//ts.ToString(@"mm\'ss\""");
|
//sportTimes.Content = _sport.GetFormatTimes();//ts.ToString(@"mm\'ss\""");
|
||||||
var counts = _sport.GetFormatCounts();
|
var counts = _sport.GetFormatCounts();
|
||||||
if (double.Parse(counts[..^1]) > 0 && _sportType == 1) //正向跳远时候&&处于测试阶段时候触发更新
|
if (double.Parse(counts[..^1]) > 0 && _sportType == 1) //正向跳远时候&&处于测试阶段时候触发更新
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ImageBehavior.SetRepeatBehavior(centerImg4, new RepeatBehavior(2));
|
||||||
|
ImageBehavior.SetRepeatBehavior(centerImg4, new RepeatBehavior(1));
|
||||||
|
ImageBehavior.GetAnimationController(centerImg4).Play();
|
||||||
|
await Task.Delay(800);
|
||||||
_sport.Stop();//关闭运动
|
_sport.Stop();//关闭运动
|
||||||
_mainWin.FacialRecognitionEvent -= this.HumanPredicting;
|
_mainWin.FacialRecognitionEvent -= this.HumanPredicting;
|
||||||
count.Text = counts;
|
count.Text = counts;
|
||||||
@ -250,10 +256,18 @@ namespace Views.JumpLong
|
|||||||
//centerImg3.Opacity = 1;
|
//centerImg3.Opacity = 1;
|
||||||
_sportType = 2;
|
_sportType = 2;
|
||||||
RankingGrid.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation);
|
RankingGrid.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation);
|
||||||
|
ImageBehavior.GetAnimationController(centerImg4).Pause();
|
||||||
|
|
||||||
//_mainWin.WebcamClient.OnExtractFrame -= this.OnFrameExtracted;
|
//_mainWin.WebcamClient.OnExtractFrame -= this.OnFrameExtracted;
|
||||||
for (int i = 12; i >= 0; i--)
|
for (int i = 12; i >= 0; i--)
|
||||||
{
|
{
|
||||||
countDown.Text = i.ToString() + "s";
|
countDown.Text = i.ToString() + "s";
|
||||||
|
|
||||||
|
if(i == 8)
|
||||||
|
{
|
||||||
|
centerImg4.Visibility = Visibility.Hidden;
|
||||||
|
centerImg3.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
{
|
{
|
||||||
RankingGrid.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation1);
|
RankingGrid.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation1);
|
||||||
@ -510,7 +524,10 @@ namespace Views.JumpLong
|
|||||||
private void StartSport()
|
private void StartSport()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Utils.PlayBackgroundMusic("countdown_3.mp3", false);
|
||||||
|
_mainWin.ShowCountDownAnimation();
|
||||||
|
centerImg3.Visibility = Visibility.Hidden;
|
||||||
|
centerImg4.Visibility = Visibility.Visible;
|
||||||
//if (_sport?.IsCounting == true)
|
//if (_sport?.IsCounting == true)
|
||||||
//_mainWin.WebcamClient.OnExtractFrame += this.OnFrameExtracted;
|
//_mainWin.WebcamClient.OnExtractFrame += this.OnFrameExtracted;
|
||||||
_sport.Start();
|
_sport.Start();
|
||||||
@ -520,6 +537,7 @@ namespace Views.JumpLong
|
|||||||
_mainWin.FacialRecognitionEvent += this.HumanPredicting;
|
_mainWin.FacialRecognitionEvent += this.HumanPredicting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private WriteableBitmap _videoBitmap;
|
private WriteableBitmap _videoBitmap;
|
||||||
private int _lastFrameNumber = -1;
|
private int _lastFrameNumber = -1;
|
||||||
private async void OnFrameExtracted(VideoFrame frame)
|
private async void OnFrameExtracted(VideoFrame frame)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user