1、关键帧动画

1)xml 界面

 <Page
x:Class="Test.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Test"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Page.Resources>
<Storyboard x:Name="Bounce">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ball" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value=""/>
<SplineDoubleKeyFrame KeyTime="00:00:04" Value=""/>
<SplineDoubleKeyFrame KeyTime="00:00:06" Value=""/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ball" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value=""/>
<SplineDoubleKeyFrame KeyTime="00:00:02" Value="-206">
<SplineDoubleKeyFrame.KeySpline>
<KeySpline ControlPoint1="0,1" ControlPoint2="1,1"/>
</SplineDoubleKeyFrame.KeySpline>
</SplineDoubleKeyFrame>
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="">
<SplineDoubleKeyFrame.KeySpline>
<KeySpline ControlPoint1="1,0" ControlPoint2="1,1"/>
</SplineDoubleKeyFrame.KeySpline>
</SplineDoubleKeyFrame>
<SplineDoubleKeyFrame KeyTime="00:00:05" Value="-20">
<SplineDoubleKeyFrame.KeySpline>
<KeySpline ControlPoint1="0,1" ControlPoint2="1,1"/>
</SplineDoubleKeyFrame.KeySpline>
</SplineDoubleKeyFrame>
<SplineDoubleKeyFrame KeyTime="00:00:06" Value="">
<SplineDoubleKeyFrame.KeySpline>
<KeySpline ControlPoint1="1,0" ControlPoint2="1,1"/>
</SplineDoubleKeyFrame.KeySpline>
</SplineDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Page.Resources>
<Grid Background="#FFF0F1FF">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions> <StackPanel x:Name="TitlePanel" Grid.Row="" Margin="12,35,0,28">
<TextBlock Foreground="CornflowerBlue" Text="Naughty Egg" FontSize="" HorizontalAlignment="Center"/>
</StackPanel>
<!--
<Grid Background="AliceBlue" x:Name="ContentPanel" Grid.Row="" Margin="12,0,12,0">
<Path Margin ="50,-200,0,0" Height="" Width="" Stretch="Uniform"
HorizontalAlignment="Left" >
<Path.Fill >
<ImageBrush Stretch="UniformToFill" ImageSource="Assets/Pic1.png" />
</Path.Fill>
<Path.Data >
<GeometryGroup FillRule="EvenOdd" >
<EllipseGeometry Center="50,50" RadiusX="" RadiusY=""
x:Name="ball">
</EllipseGeometry>
</GeometryGroup>
</Path.Data>
</Path>
</Grid>
-->
<Grid x:Name="ContentPanel" Grid.Row="" Margin="12,0,12,0">
<Path Margin ="60,-250,0,0" Height="" Width="" Stretch="Uniform"
HorizontalAlignment="Left">
<Path.Fill >
<ImageBrush Stretch="UniformToFill" ImageSource="Assets/Pic1.png" />
</Path.Fill>
<Path.Data>
<GeometryGroup FillRule="EvenOdd" >
<EllipseGeometry RadiusX="" RadiusY=""
Center="100,100">
</EllipseGeometry>
</GeometryGroup>
</Path.Data>
</Path>
<Ellipse Height="" HorizontalAlignment="Left" Margin="5,0,0,151" VerticalAlignment="Bottom" Width="" Fill="#FFF40B0B" Stroke="#FF000000" x:Name="ball" RenderTransformOrigin="0.5,0.5" Opacity="0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
<StackPanel Margin="0,300,0,100" >
<ProgressRing Background="#FFF0F1FF" x:Name="prgRing" Width="" Height="" Foreground="LightSeaGreen"
IsActive ="True" /> </StackPanel> </Grid> </Grid> </Page>

2) .cs 中控制播放:

 public MainPage()
{
this.InitializeComponent();
//开始运行Storyboard
Bounce.Begin();
Bounce.Completed += ToNewPage; timer.Tick += dispatcherTimer_Tick;
timer.Interval = TimeSpan.FromSeconds(1.1); //设置刷新的间隔时间
timer.Start();
}
void dispatcherTimer_Tick(object sender, object e)
{
//function to execute
count++;
if (count == )
{
this.prgRing.IsActive = false;
} }
private void ToNewPage(object sender, object e)
{
Frame rootFrame = this.Parent as Frame;
if (rootFrame == null)
{
return;
} rootFrame.Navigate(typeof(Choice));
}

3)效果:

     

2、C#中的触控

     xml:

         <Grid x:Name="gamegrid" RenderTransformOrigin="0.335,0.445" Margin="0,0,0,49"
Background="White" Opacity="0.9">
<Canvas Name="canvas" Margin="5,4,5,3" >
<Ellipse Name="circle"
Width=""
Height=""
Canvas.Left=""
ManipulationDelta="OnManipulationDelta" ManipulationStarting="OnManipulationStarting"
ManipulationCompleted="OnManipulationCompleted" PointerPressed="finger_PointerPressed"
PointerMoved="finger_PointerMoved" PointerReleased="finger_PointerReleased"
Canvas.Top="" RenderTransformOrigin="3.56,3.875">
<Ellipse.DataContext>
<Button Content=" " ></Button>
<!--<Image Name="img1" Source="Assets/Pic2.png" Margin="" Width="" Height="" />-->
</Ellipse.DataContext>
</Ellipse> <TextBlock Foreground="CornflowerBlue" Canvas.Left="" TextWrapping="Wrap" Text="Grades" Canvas.Top="" FontSize="" Height="" Width=""
/>
<TextBlock Height="" Canvas.Left="" TextWrapping="Wrap"
Name="test" Foreground="CornflowerBlue"
Text="{Binding Path=HP}" Canvas.Top="" Width="" FontSize="" FontFamily="Buxton Sketch"
/>
<TextBlock HorizontalAlignment="Center" Name="lev" Foreground="CornflowerBlue" FontSize="" Canvas.Left="" TextWrapping="Wrap" Text="level1" Canvas.Top="" Height="" Width=""/>
</Canvas> </Grid> </Grid>
</Page>

     .cs控制:

  //控制触摸移动的开始
private void OnManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e)
{
mapMode = e.Mode;
}
//移动中触发
private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
if (ManipulationModes.TranslateX == (mapMode & ManipulationModes.TranslateX))
{
cpTransform.TranslateX += e.Delta.Translation.X;
x = cpTransform.TranslateX;
}
if (ManipulationModes.TranslateY == (mapMode & ManipulationModes.TranslateY))
{
cpTransform.TranslateY += e.Delta.Translation.Y;
y = (double)cpTransform.TranslateY;
} }
// 移动停止时触发
private void OnManipulationCompleted(object sender,ManipulationCompletedRoutedEventArgs e)
{ } // 按下时触发
Boolean pushDown = false;
private void finger_PointerPressed(object sender, PointerRoutedEventArgs e)
{
pushDown = true;
// rect1.Fill = new SolidColorBrush(Colors.Black); }
// 指针或手松开时触发
private void finger_PointerReleased(object sender, PointerRoutedEventArgs e)
{
pushDown = false;
//rect1.Fill = new SolidColorBrush(Colors.Orange);
if (p.HP <= && p.HP >= )
{
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);
XmlNodeList elements = toastXml.GetElementsByTagName("text");
elements[].AppendChild(toastXml.CreateTextNode("恭喜你成为人生赢家!"));
ToastNotification toast = new ToastNotification(toastXml);
ToastNotificationManager.CreateToastNotifier().Show(toast);
}
}
// 按下手或指针移动过程中触发
private void finger_PointerMoved(object sender, PointerRoutedEventArgs e)
{
Point p = e.GetCurrentPoint(circle).Position;
Point p2 = e.GetCurrentPoint(rect1).Position;
mousepoint = e.GetCurrentPoint(circle).Position;
if (pushDown) {
if (tag == )
{
rect1.Fill = new SolidColorBrush(Colors.Red); //矩形的填充颜色为红色!
changecolor(p2);
}
else
{
changecolor2(p2);
rect1.Fill = new SolidColorBrush(Colors.Green); //矩形的填充颜色为绿色!
}
}
}

      效果:

        

3、画刷

 前端xml界面:

  <Grid x:Name="ContentPanel" Grid.Row="" Margin="12,0,12,0">
<Path Margin ="60,-250,0,0" Height="" Width="" Stretch="Uniform"
HorizontalAlignment="Left">
<Path.Fill >
<ImageBrush Stretch="UniformToFill" ImageSource="Assets/Pic1.png" />
</Path.Fill>
<Path.Data>
<GeometryGroup FillRule="EvenOdd" >
<EllipseGeometry RadiusX="" RadiusY=""
Center="100,100">
</EllipseGeometry>
</GeometryGroup>
</Path.Data>
</Path>
<Ellipse Height="" HorizontalAlignment="Left" Margin="5,0,0,151" VerticalAlignment="Bottom" Width="" Fill="#FFF40B0B" Stroke="#FF000000" x:Name="ball" RenderTransformOrigin="0.5,0.5" Opacity="0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
<StackPanel Margin="0,300,0,100" >
<ProgressRing Background="#FFF0F1FF" x:Name="prgRing" Width="" Height="" Foreground="LightSeaGreen"
IsActive ="True" /> </StackPanel> </Grid>

 效果:

      见上图中透出的椭圆形图片效果

Lesson9 some interesting things in C#的更多相关文章

  1. An interesting experiment on China’s censorship

    This paper presented a very interesting topic. Censorship in China has always drawn people's attenti ...

  2. 2015年辽宁省赛Interesting Tree

    题目描述 Recently, Miss Huang want to receive a Tree as her birthday gift! (What a interesting person!)  ...

  3. HDU5785 Interesting(Manacher + 延迟标记)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5785 Description Alice get a string S. She think ...

  4. ural 2070. Interesting Numbers

    2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...

  5. 多校赛3- Solve this interesting problem 分类: 比赛 2015-07-29 21:01 8人阅读 评论(0) 收藏

    H - Solve this interesting problem Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I ...

  6. hdu Interesting Fibonacci

    Interesting Fibonacci Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Ot ...

  7. CF #365 (Div. 2) D - Mishka and Interesting sum 离线树状数组

    题目链接:CF #365 (Div. 2) D - Mishka and Interesting sum 题意:给出n个数和m个询问,(1 ≤ n, m ≤ 1 000 000) ,问在每个区间里所有 ...

  8. CF #365 (Div. 2) D - Mishka and Interesting sum 离线树状数组(转)

    转载自:http://www.cnblogs.com/icode-girl/p/5744409.html 题目链接:CF #365 (Div. 2) D - Mishka and Interestin ...

  9. Calculations are rather interesting

    Calculations are rather interesting, especially when some thoughts are involved therein.

随机推荐

  1. IntelliJ IDEA 12 创建Web项目 教程 超详细版【转】

    IntelliJ IDEA 12 新版本发布 第一时间去官网看了下  黑色的主题 很给力 大体使用了下  对于一开始就是用eclipse的童鞋们 估计很难从eclipse中走出来 当然 我也很艰难的走 ...

  2. B1008 数组元素循环右移问题 (20分)

    B1008 数组元素循环右移问题 (20分) 思路 1 2 3 4 5 6 5 6 1 2 3 4 6个数,循环右移2位. 也可以理解为 先翻转 6 5 4 3 2 1 然后再两部分,分别翻转 5 6 ...

  3. python—— 文件的打开模式和文件对象方法 & os、os.path 模块中关于文件、目录常用的函数使用方法

    引用自“鱼c工作室”     文件的打开模式和文件对象方法  : https://fishc.com.cn/forum.php?mod=viewthread&tid=45279&ext ...

  4. filter() 函数的使用

    Python3 filter() 函数 描述 filter() 函数用于过滤序列,过滤掉不符合条件的元素,返回一个迭代器对象,如果要转换为列表,可以使用 list() 来转换. 该接收两个参数,第一个 ...

  5. 27-Middleware管道介绍

    1-Middleware管道介绍,. 如果匹配上/task,则界面只会显示i am task. public void Configure(IApplicationBuilder app, IHost ...

  6. Hive 文件格式 & Hive操作(外部表、内部表、区、桶、视图、索引、join用法、内置操作符与函数、复合类型、用户自定义函数UDF、查询优化和权限控制)

    本博文的主要内容如下: Hive文件存储格式 Hive 操作之表操作:创建外.内部表 Hive操作之表操作:表查询 Hive操作之表操作:数据加载 Hive操作之表操作:插入单表.插入多表 Hive语 ...

  7. Android面试收集录15 Android Bitmap压缩策略

    一.为什么Bitmap需要高效加载? 现在的高清大图,动辄就要好几M,而Android对单个应用所施加的内存限制,只有小几十M,如16M,这导致加载Bitmap的时候很容易出现内存溢出.如下异常信息, ...

  8. 在MAC下使用Robotframework+Selenium2【第二枪】如何处理Table点击指定记录

    1.通过关键字Get Matching Xpath Count获取table中的记录 2.遍历Table所有记录 3.判断记录是否符合条件,做点击操作

  9. 17 rest-framework框架的基本组件

    序列化 创建一个序列化类 简单使用 开发我们的Web API的第一件事是为我们的Web API提供一种将代码片段实例序列化和反序列化为诸如json之类的表示形式的方式.我们可以通过声明与Django ...

  10. MyEclipse - 问题集 - Workspace in use or cannot be created, choose a different one(转)

    转:http://wsfly.iteye.com/blog/1044986 eclipse 使用一段时间后,有时会因为一些故障自己就莫名奇妙的关闭了,再打开时有时没有问题,有时有会提示错误 Works ...