zoukankan      html  css  js  c++  java
  • WPF 扩大,回弹效果

    <Window x:Class="Fish.AccountBook.View.Test.PanelWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="PanelWindow" Height="300" Width="500">
        <Grid>
            <Rectangle Name="rectangle1" Height="104" 
                       HorizontalAlignment="Left" 
                       Margin="68,78,0,0" Stroke="Black" 
                       VerticalAlignment="Top" Width="158" 
                       RenderTransformOrigin="0.5,0.5" >
                <Rectangle.RenderTransform>
                    <ScaleTransform x:Name="m_Scale" ScaleX="0.1" ScaleY="0.1" />
                </Rectangle.RenderTransform>
            </Rectangle>
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="312,157,0,0" Name="button1" VerticalAlignment="Top" Width="75">
                <Button.Triggers>
                    <EventTrigger RoutedEvent="Button.Click">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation 
                                    Storyboard.TargetName="m_Scale"
                                    Storyboard.TargetProperty="ScaleX"
                                    From="0.1" To="1" Duration="0:0:1">
                                    <DoubleAnimation.EasingFunction>
                                        <ElasticEase EasingMode="EaseOut" Oscillations="2" Springiness="4" />
                                    </DoubleAnimation.EasingFunction>
                                </DoubleAnimation>
                                <DoubleAnimation 
                                    Storyboard.TargetName="m_Scale"
                                    Storyboard.TargetProperty="ScaleY"
                                    From="0.1" To="1" Duration="0:0:1" >
                                    <DoubleAnimation.EasingFunction>
                                        <ElasticEase EasingMode="EaseOut" Oscillations="2" Springiness="4" />
                                    </DoubleAnimation.EasingFunction>
                                </DoubleAnimation>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Button.Triggers>
            </Button>
        </Grid>
    </Window>

    CS:

    EasingFunctionBase easing = new ElasticEase()
                {
                    EasingMode = EasingMode.EaseOut,
                    Oscillations = 5,
                    Springiness = 10
                };
    
                DoubleAnimation inAnimation = new DoubleAnimation()
                {
                    From = 0.1,
                    To = 1,
                    EasingFunction = easing,
                    Duration = new Duration(TimeSpan.FromSeconds(5))
                };
    
                AnimationClock clock = inAnimation.CreateClock();
                this.m_Scale.ApplyAnimationClock(ScaleTransform.ScaleXProperty, clock);
                this.m_Scale.ApplyAnimationClock(ScaleTransform.ScaleYProperty, clock);
  • 相关阅读:
    Windows下使用nmake编译C/C++的makefile
    poj 1228
    poj 1039
    poj 1410
    poj 3304
    poj 1113
    poj 2074
    uva 1423 LA 4255
    poj 1584
    poj 3277
  • 原文地址:https://www.cnblogs.com/sshoub/p/2535490.html
Copyright © 2011-2022 走看看