本文整理汇总了C#中System.Windows.Media.Animation.ThicknessAnimation类的典型用法代码示例。如果您正苦于以下问题:C# ThicknessAnimation类的具体用法?C# ThicknessAnimation怎么用?C# ThicknessAnimation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThicknessAnimation类属于System.Windows.Media.Animation命名空间,在下文中一共展示了ThicknessAnimation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Show
/// <summary>
/// 动态显示内容
/// </summary>
/// <param name="target"></param>
/// <param name="duration"></param>
public static void Show(ContentControl target, double duration = .8)
{
ThicknessAnimation animtion = new ThicknessAnimation()
{
From = new Thickness(target.Margin.Left + 80, target.Margin.Top, target.Margin.Right, target.Margin.Bottom),
To = new Thickness(160, 0, 0, 0),
Duration = TimeSpan.FromSeconds(duration),
FillBehavior = FillBehavior.HoldEnd,
AccelerationRatio = .5,
EasingFunction = be
};
DoubleAnimation animtion2 = new DoubleAnimation()
{
From = 0,
To = 1,
Duration = TimeSpan.FromSeconds(duration),
FillBehavior = FillBehavior.HoldEnd,
AccelerationRatio = .5,
EasingFunction = be
};
target.BeginAnimation(ContentControl.MarginProperty, animtion);
target.BeginAnimation(ContentControl.OpacityProperty, animtion2);
}
开发者ID:ONEWateR,项目名称:FlowMonitor,代码行数:31,代码来源:CAAnimation.cs
示例2: FadeInAnimation
private static Storyboard FadeInAnimation(int interval, params FrameworkElement[] controls)
{
Storyboard fadeInAnimation = new Storyboard();
int counter = 0;
foreach (var control in controls)
{
control.BeginAnimation(OpacityProperty, null);
control.BeginAnimation(MarginProperty, null);
control.Opacity = 0;
control.Margin = new Thickness(0, control.Margin.Top, 0, 0);
DoubleAnimation da = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(300));
ThicknessAnimation ta = new ThicknessAnimation(new Thickness(-10, control.Margin.Top, 10, 0), new Thickness(0, control.Margin.Top, 0, 0), TimeSpan.FromMilliseconds(400));
Storyboard.SetTarget(da, control);
Storyboard.SetTarget(ta, control);
Storyboard.SetTargetProperty(da, new PropertyPath(OpacityProperty));
Storyboard.SetTargetProperty(ta, new PropertyPath(MarginProperty));
fadeInAnimation.Children.Add(da);
fadeInAnimation.Children.Add(ta);
da.BeginTime = TimeSpan.FromMilliseconds(counter * interval);
ta.BeginTime = TimeSpan.FromMilliseconds(counter * interval);
counter++;
}
fadeInAnimation.Completed += (s, e) =>
{
foreach (var c in controls)
{
c.Opacity = 1;
}
};
return fadeInAnimation;
}
开发者ID:WELL-E,项目名称:Hurricane,代码行数:32,代码来源:AnimatedStackPanel.cs
示例3: Flush
public void Flush()
{
var thicknessAnimationUsingKeyFrames = new ThicknessAnimationUsingKeyFrames();
thicknessAnimationUsingKeyFrames.KeyFrames = new ThicknessKeyFrameCollection();
double delta = (Width - Height) / 2;
var thicknessAnimation = new ThicknessAnimation()
{
From = new Thickness(delta, 0, delta, 0),
To = new Thickness(delta - 500, -500, delta - 500, -500),
Duration = new Duration(TimeSpan.FromSeconds(1)),
AutoReverse = true
};
thicknessAnimation.Completed += new EventHandler(animation_Completed);
_flushEllipse = new Ellipse()
{
Fill = new SolidColorBrush(Colors.LightBlue),
Stroke = new SolidColorBrush(Colors.Orange),
StrokeThickness = 5,
Opacity = 0.5
};
Children.Add(_flushEllipse);
_flushEllipse.BeginAnimation(Ellipse.MarginProperty, thicknessAnimation);
}
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:27,代码来源:ElementXDeviceView.xaml.cs
示例4: txt_PreviewMouseUp
private void txt_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
DoubleAnimation title_width_animation = new DoubleAnimation();
ThicknessAnimation title_margin_animation = new ThicknessAnimation();
DoubleAnimation content_width_animation = new DoubleAnimation();
DoubleAnimation content_height_animation = new DoubleAnimation();
ThicknessAnimation content_margin_animation = new ThicknessAnimation();
DoubleAnimation txt_width_animation = new DoubleAnimation();
ThicknessAnimation txt_margin_animation = new ThicknessAnimation();
if (txt.Width < 720 || txt.ActualWidth < 720)
{
title_width_animation.To = SystemParameters.PrimaryScreenWidth;
title_margin_animation.To = new Thickness(0, 10, 0, 0);
content_height_animation.To = SystemParameters.PrimaryScreenHeight - 105;
content_width_animation.To = SystemParameters.PrimaryScreenWidth;
content_margin_animation.To = new Thickness(0, 10, 0, 0);
txt_width_animation.To = SystemParameters.PrimaryScreenWidth;
txt_margin_animation.From = new Thickness(0, 0, 0, 0);
txt_margin_animation.To = new Thickness(0, SystemParameters.PrimaryScreenHeight-txt.ActualHeight - 110, 0, 0);
}
else
{
title_width_animation.To = 392;
title_margin_animation.To = new Thickness(0, 200, 0, 0);
content_height_animation.To = 533;
content_width_animation.To = 392;
content_margin_animation.To = new Thickness(0, 10, 0, 0);
txt_margin_animation.From = new Thickness(0, 0, 0, 0);
txt_margin_animation.To = new Thickness(0, SystemParameters.PrimaryScreenHeight-txt.ActualHeight -110, 0, 0);
//txt_width_animation.To = SystemParameters.PrimaryScreenWidth;
}
title_width_animation.Duration = TimeSpan.FromSeconds(0.5);
title_margin_animation.Duration = TimeSpan.FromSeconds(0.5);
content_height_animation.Duration = TimeSpan.FromSeconds(0.5);
content_width_animation.Duration = TimeSpan.FromSeconds(0.5);
content_margin_animation.Duration = TimeSpan.FromSeconds(0.5);
txt_width_animation.Duration = TimeSpan.FromSeconds(0.5);
txt_margin_animation.Duration = TimeSpan.FromSeconds(500);
txt.BeginAnimation(StackPanel.WidthProperty, title_width_animation);
txt.BeginAnimation(StackPanel.MarginProperty, title_margin_animation);
//content.BeginAnimation(StackPanel.HeightProperty, content_height_animation);
//content.BeginAnimation(StackPanel.WidthProperty, title_width_animation);
//content.BeginAnimation(StackPanel.MarginProperty, content_margin_animation);
txt.BeginAnimation(TextBlock.WidthProperty, txt_width_animation);
txt.BeginAnimation(TextBlock.MarginProperty, txt_margin_animation);
}
开发者ID:cloudtimesoft,项目名称:fcb_public,代码行数:60,代码来源:sub_show.xaml.cs
示例5: Button_Click_1
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Ellipse ellipse1 = new Ellipse();
ellipse1.Width = 50;
ellipse1.Height = 20;
ellipse1.ToolTip = "Touch Me / Потискай меня";
ellipse1.StrokeThickness = 2;
ellipse1.Stroke = Brushes.Black;
ellipse1.Fill = Brushes.Red;
Mygrid.Children.Add(ellipse1);
Ellipse ellipse2 = new Ellipse();
ellipse2.Width = 50;
ellipse2.Height = 20;
ellipse2.ToolTip = "Touch Me / Потискай меня";
ellipse2.StrokeThickness = 2;
ellipse2.Stroke = Brushes.Red;
ellipse2.Fill = Brushes.Green;
Mygrid.Children.Add(ellipse2);
Random rand1 = new Random((int)DateTime.Now.Ticks);
Random rand2 = new Random((int)DateTime.Now.Ticks);
ThicknessAnimation TA1 = new ThicknessAnimation(); //Анимация перемещения
TA1.From = ellipse1.Margin = new Thickness(10, 100, 0, 0); //Координаты начального положения
TA1.To = ellipse1.Margin = new Thickness(1400, 100, 0, 0); //Координаты конечного положения
TA1.Duration = TimeSpan.FromSeconds(rand1.Next(10, 20)); //Время анимации
ellipse1.BeginAnimation(MarginProperty, TA1); //Запуск анимации
ThicknessAnimation TA2 = new ThicknessAnimation(); //Анимация перемещения
TA2.From = ellipse2.Margin = new Thickness(10, 200, 0, 0); //Координаты начального положения
TA2.To = ellipse2.Margin = new Thickness(1400, 200, 0, 0); //Координаты конечного положения
TA2.Duration = TimeSpan.FromSeconds(rand2.Next(10, 20)); //Время анимации
ellipse2.BeginAnimation(MarginProperty, TA2); //Запуск анимации
}
开发者ID:3A9C,项目名称:ITstep,代码行数:34,代码来源:MainWindow.xaml.cs
示例6: AvatarBounce
private void AvatarBounce()
{
var bounce = new BounceEase { Bounces = 3, Bounciness = 10 };
var a = new ThicknessAnimation(new Thickness(10, -800, 0, 810), new Thickness(10, 10, 0, 0),
new Duration(new TimeSpan(0, 0, 1))) {EasingFunction = bounce};
Avi.BeginAnimation(MarginProperty, a);
}
开发者ID:Conji,项目名称:Cloudsdale-Win7,代码行数:8,代码来源:UserFlyout.xaml.cs
示例7: AnimationUp
private void AnimationUp(Grid grid)
{
ThicknessAnimation ta = new ThicknessAnimation();
ta.From = grid.Margin;
ta.To = new Thickness(grid.Margin.Left, RowHeight + SpaceBetweenGrids, 0, 0);
ta.Duration = new Duration(TimeSpan.FromSeconds(0.5));
grid.BeginAnimation(Grid.MarginProperty, ta);
}
开发者ID:damy90,项目名称:Telerik-all,代码行数:8,代码来源:Settings.xaml.cs
示例8: BtnBack_Click
private void BtnBack_Click(object sender, RoutedEventArgs e)
{
ThicknessAnimation ta = new ThicknessAnimation(new Thickness(-618, 0, 1003, 0), new Duration(TimeSpan.FromMilliseconds(350)));
ExponentialEase ee = new ExponentialEase();
ee.EasingMode = EasingMode.EaseOut;
ta.EasingFunction = ee;
ta.Completed += ta_Completed;
this.OptGrid.BeginAnimation(MarginProperty, ta);
}
开发者ID:lantian2012,项目名称:3DS-GuitarHero,代码行数:9,代码来源:VHelpPage.xaml.cs
示例9: DockPanel_MouseEnter
private void DockPanel_MouseEnter(object sender, MouseEventArgs e) {
var ta = new ThicknessAnimation();
/*
ta.From = MenuCanvas.Margin;
ta.To = new Thickness(0,15,-360,0);
ta.Duration = new Duration(TimeSpan.FromMilliseconds(500));
MenuCanvas.BeginAnimation(MarginProperty, ta);
*/
}
开发者ID:Rushman1,项目名称:PictureViewer,代码行数:9,代码来源:Shell.xaml.cs
示例10: Beweeg
public void Beweeg(Point target)
{
var thickness = new Thickness(target.X, target.Y, 0, 0);
var moveAnimation = new ThicknessAnimation(Margin, thickness, TimeSpan.FromMilliseconds(500))
{
FillBehavior = FillBehavior.Stop
};
moveAnimation.Completed += (sender, args) => Margin = thickness;
BeginAnimation(MarginProperty, moveAnimation);
}
开发者ID:Roconda,项目名称:Barricade,代码行数:10,代码来源:Barricade.xaml.cs
示例11: CreateSlideInAnimation
static AnimationTimeline CreateSlideInAnimation(FrameworkElement frameworkElement)
{
var parent = frameworkElement.Parent as FrameworkElement;
var marginAnimation = new ThicknessAnimation();
marginAnimation.From = new Thickness(parent.ActualWidth, 0, 0, 0);
marginAnimation.To = new Thickness(0);
marginAnimation.Duration = duration;
return marginAnimation;
}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:10,代码来源:SlideBehaviour.cs
示例12: StartLeaveAnimation
private void StartLeaveAnimation() {
var ta=new ThicknessAnimation();
/*
ta.From=MenuCanvas.Margin;
ta.To=new Thickness(0, 15, -410, 0);
ta.Duration=new Duration(TimeSpan.FromMilliseconds(500));
MenuCanvas.BeginAnimation(MarginProperty, ta);
*/
}
开发者ID:Rushman1,项目名称:PictureViewer,代码行数:10,代码来源:Shell.xaml.cs
示例13: HideMessage
public void HideMessage()
{
ThicknessAnimation ta1 = new ThicknessAnimation();
ta1.To = new Thickness(848, 55, 0, 0);
ta1.Duration = new Duration(TimeSpan.FromSeconds(2));
DoubleAnimation da1 = new DoubleAnimation();
da1.To = 0;
da1.Duration = new Duration(TimeSpan.FromSeconds(2));
PopupContainer.BeginAnimation(Grid.MarginProperty, ta1);
PopupContainer.BeginAnimation(Grid.OpacityProperty, da1);
}
开发者ID:HamzaElgarrab,项目名称:LeGarage_Client,代码行数:11,代码来源:MainWindow.xaml.cs
示例14: SideBarAnimation
private static void SideBarAnimation(Panel sideBar, int from, int to, ThicknessAnimation ta)
{
DoubleAnimation da = new DoubleAnimation();
da.From = from;
da.To = to;
da.Duration = TimeSpan.FromSeconds(0.4);
sideBar.BeginAnimation(TextBlock.OpacityProperty, da);
ta.Duration = TimeSpan.FromSeconds(0.2);
sideBar.BeginAnimation(TextBlock.MarginProperty, ta);
}
开发者ID:QingWei-Li,项目名称:MyLife,代码行数:11,代码来源:MainWindow.xaml.cs
示例15: Animation
static Animation()
{
ca = new ColorAnimation();
ta = new ThicknessAnimation();
da = new DoubleAnimation();
sbOnce = new Storyboard();
sbForever = new Storyboard();
sbForever.RepeatBehavior = RepeatBehavior.Forever;
sbForever.Children.Add(new DoubleAnimation());
sb = sbOnce;
sb.Children.Add(new DoubleAnimation());
}
开发者ID:RicoAcuzar,项目名称:SysAd-Project,代码行数:12,代码来源:Animation.cs
示例16: ContentBouncer
public ContentBouncer()
{
_aniSlider = new ThicknessAnimation
{
AutoReverse = true,
FillBehavior = FillBehavior.Stop,
RepeatBehavior = RepeatBehavior.Forever,
BeginTime = TimeSpan.FromSeconds(.5),
};
Loaded += ContentBouncer_Loaded;
}
开发者ID:Garfield-Chen,项目名称:mabicommerce,代码行数:12,代码来源:ContentBouncer.cs
示例17: ShowMessage
public void ShowMessage(int type)
{
PopupContainer.Children.Add(new Popup(type));
ThicknessAnimation ta = new ThicknessAnimation();
ta.To = new Thickness(848, 43, 0, 0);
ta.Duration = new Duration(TimeSpan.FromSeconds(0.75));
DoubleAnimation da = new DoubleAnimation();
da.To = 1;
da.Duration = new Duration(TimeSpan.FromSeconds(0.75));
PopupContainer.BeginAnimation(Grid.MarginProperty, ta);
PopupContainer.BeginAnimation(Grid.OpacityProperty, da);
}
开发者ID:HamzaElgarrab,项目名称:LeGarage_Client,代码行数:12,代码来源:MainWindow.xaml.cs
示例18: frameGuide_Navigated
private void frameGuide_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
var ani = new ThicknessAnimation(new Thickness(10, 0, -10, 0), new Thickness(0), TimeSpan.FromSeconds(0.25));
var ani1 = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(0.25));
frameGuide.BeginAnimation(MarginProperty, ani);
frameGuide.BeginAnimation(OpacityProperty, ani1);
if (e.Uri != null)
{
if (e.Uri.OriginalString.Equals("Guide/PageGuideEnd.xaml"))
{
Close();
}
}
}
开发者ID:cvronmin,项目名称:metocraft,代码行数:14,代码来源:GuideWindow.xaml.cs
示例19: frameGuide_Navigated
private void frameGuide_Navigated(object sender, NavigationEventArgs e)
{
var ani = new ThicknessAnimation(new Thickness(10, 0, -10, 0), new Thickness(0), TimeSpan.FromSeconds(0.25));
var ani1 = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(0.25));
VisualStateManager.GoToState(this, "AfterLoaded", true);
frameGuide.BeginAnimation(MarginProperty, ani);
frameGuide.BeginAnimation(OpacityProperty, ani1);
if (e.Uri != null)
{
if (e.Uri.OriginalString.Equals("Guide/PageGuideTOTHY.xaml"))
{
Back();
}
}
}
开发者ID:cvronmin,项目名称:metocraft,代码行数:15,代码来源:GridGuide.xaml.cs
示例20: ZoomControl
public ZoomControl()
{
_scaleTrasform = new ScaleTransform();
_transformGroup = new TransformGroup();
_transformGroup.Children.Add(_scaleTrasform);
_animZoom = new DoubleAnimation();
_animPositionX = new DoubleAnimation();
_animPositionY = new DoubleAnimation();
_animMargin = new ThicknessAnimation();
_animZoom.Duration = _animMargin.Duration = _animPositionX.Duration = _animPositionX.Duration = AnimationDuration;
_animZoom.EasingFunction = _animMargin.EasingFunction = new CircleEase();
_animZoom.Completed += new EventHandler(_animZoom_Completed);
}
开发者ID:dotCtor,项目名称:WpfControls,代码行数:15,代码来源:ZoomControl.cs
注:本文中的System.Windows.Media.Animation.ThicknessAnimation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论