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. PHP自动生成分页链接

    page.class.php <?php class Page { // 分页栏每页显示的页数 public $rollPage = 5; // 页数跳转时要带的参数 public $param ...

  2. Redis数据库 : python与java操作redis

    redis 包 from redis import * 连接: r = StrictRedis(host='localhost', port='6379') 读写:r.set('key','value ...

  3. java的有用基础知识(2013-05-02-bd 写的日志迁移

    JDK 是整个Java的核心,包括了Java运行环境.Java工具和Java基础类库.是java开发工具包 jre是java的运行环境(如果不做开发就不用安装jdk单独安装jre就可以运行java程序 ...

  4. ios 苹果内购订单验证 --- nodejs实现

    实现代码 function IosPlayVerify(data,orderid,cb) { itunesPost(data,function (error,responseData) { if (e ...

  5. 用php读取xml数据

    parser是php内置的一个用来处理xml的解析器,它的工作由三个事件组成:起始标签. 读取数据.结束标签. 也就是说在对xml进行处理的时候每当遇到起始标签.数据和结束标签的时候函数会做相应的动作 ...

  6. 汉罗塔问题——Python

    汉罗塔问题就是一个循环的过程:* (有两种情况) 如果被移动盘只有一个盘子,可以直接移动到目的盘 但是被移动盘有多个盘子,就先需要将上面的n-1个盘子通过目的盘移动到辅助盘,然后将被移动盘最下面一个盘 ...

  7. equals和toString

    Object的equals方法默认比较地址值.所以当需要比较两个对象的内容时需要重写equals方法.

  8. R语言中的机器学习包

    R语言中的机器学习包   Machine Learning & Statistical Learning (机器学习 & 统计学习)  网址:http://cran.r-project ...

  9. 以最省内存的方式把大图片加载到内存及获取Exif信息和获取屏幕高度和宽度的新方法

    我们在加载图片时经常会遇到内存溢出的问题,图片太大,我们加载图片时,一般都是用的如下一般方法(加载本地图片): /** * 不作处理,去加载图片的方法,碰到比较大的图片会内存溢出 */ private ...

  10. 《Cracking the Coding Interview》——第5章:位操作——题目3

    2014-03-19 05:57 题目:给定一个整数N,求出比N大,而且二进制表示中和N有相同个数的‘1’的最小的数,比如3是‘11’,接下来的5是‘101’,再接下来的6是‘110’. 解法:从低位 ...