WPF鼠标点击动画
前台代码
<Page x:Class="PerFrameAnimation.ParticleEffectExamples"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ae="clr-namespace:PerFrameAnimation">
<Page.Resources>
<Style TargetType="{x:Type Slider}">
<Setter Property="Width" Value="200" />
</Style>
</Page.Resources>
<DockPanel>
<Border BorderBrush="Black" Background="#8000" Padding="10" DockPanel.Dock="Top">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock>Drag:</TextBlock>
<Slider Orientation="Horizontal" Minimum="0.0" Maximum="1.0" SmallChange="0.05" LargeChange="0.2" DataContext="{Binding ElementName=MagCanvas}" Value="{Binding Path=Drag}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock>Border Force:</TextBlock>
<Slider Orientation="Horizontal" Minimum="0.0" Maximum="5000.0" SmallChange="100" LargeChange="500" DataContext="{Binding ElementName=MagCanvas}" Value="{Binding Path=BorderForce}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock>Child Force:</TextBlock>
<Slider Orientation="Horizontal" Minimum="0.0" Maximum="1000.0" SmallChange="10" LargeChange="100" DataContext="{Binding ElementName=MagCanvas}" Value="{Binding Path=ChildForce}"/>
</StackPanel>
</StackPanel>
</Border>
<Canvas x:Name="PageCanvas">
<ae:MagnitismCanvas x:Name="MagCanvas" Drag="0.8" BorderForce="1000" ChildForce="100"
DataContext="{Binding ElementName=PageCanvas}" Width="{Binding Path=ActualWidth}" Height="{Binding Path=ActualHeight}">
<ae:FireworkEffect Canvas.Top="100" Canvas.Left="100">
<ae:FireworkEffect.Child>
<Button>Click For Fireworks</Button>
</ae:FireworkEffect.Child>
</ae:FireworkEffect>
<ae:SonicEffect Canvas.Top="200" Canvas.Left="200" RingThickness="10" RingRadius="15" RingDelay="0:0:0.1" RingColor="#22553366">
<ae:SonicEffect.Child>
<Button>Click For Sonic burst</Button>
</ae:SonicEffect.Child>
</ae:SonicEffect>
<ae:FireworkEffect Canvas.Top="300" Canvas.Left="100">
<ae:FireworkEffect.Child>
<Button>Click For Fireworks</Button>
</ae:FireworkEffect.Child>
</ae:FireworkEffect>
<ae:SonicEffect Canvas.Top="400" Canvas.Left="200" RingThickness="10" RingRadius="15" RingDelay="0:0:0.1" RingColor="#22553366">
<ae:SonicEffect.Child>
<Button>Click For Sonic burst</Button>
</ae:SonicEffect.Child>
</ae:SonicEffect>
<ae:FireworkEffect Canvas.Top="500" Canvas.Left="100">
<ae:FireworkEffect.Child>
<Button>Click For Fireworks</Button>
</ae:FireworkEffect.Child>
</ae:FireworkEffect>
<ae:SonicEffect Canvas.Top="100" Canvas.Left="600" RingThickness="10" RingRadius="15" RingDelay="0:0:0.1" RingColor="#22553366">
<ae:SonicEffect.Child>
<Button>Click For Sonic burst</Button>
</ae:SonicEffect.Child>
</ae:SonicEffect>
<ae:FireworkEffect Canvas.Top="200" Canvas.Left="500">
<ae:FireworkEffect.Child>
<Button>Click For Fireworks</Button>
</ae:FireworkEffect.Child>
</ae:FireworkEffect>
<ae:SonicEffect Canvas.Top="300" Canvas.Left="600" RingThickness="10" RingRadius="15" RingDelay="0:0:0.1" RingColor="#22553366">
<ae:SonicEffect.Child>
<Button>Click For Sonic burst</Button>
</ae:SonicEffect.Child>
</ae:SonicEffect>
<ae:FireworkEffect Canvas.Top="400" Canvas.Left="500">
<ae:FireworkEffect.Child>
<Button>Click For Fireworks</Button>
</ae:FireworkEffect.Child>
</ae:FireworkEffect>
<ae:SonicEffect Canvas.Top="500" Canvas.Left="600" RingThickness="10" RingRadius="15" RingDelay="0:0:0.1" RingColor="#22553366">
<ae:SonicEffect.Child>
<Button>Click For Sonic burst</Button>
</ae:SonicEffect.Child>
</ae:SonicEffect>
</ae:MagnitismCanvas>
</Canvas>
</DockPanel>
</Page>
后台代码
using System.Windows.Controls;
namespace PerFrameAnimation
{
/// <summary>
/// Interaction logic for ParticleEffectExamples.xaml
/// </summary>
public partial class ParticleEffectExamples : Page
{
}
}