public void AnimateVertexBackward(VertexControl target) { var transform = CustomHelper.GetScaleTransform(target); if (transform == null) { target.RenderTransform = new ScaleTransform(); transform = target.RenderTransform as ScaleTransform; target.RenderTransformOrigin = CenterScale ? new Point(.5, .5) : new Point(0, 0); return; //no need to back cause default already } if (transform.ScaleX <= 1 || transform.ScaleY <= 1) return; var sb = new Storyboard(); var scaleAnimation = new DoubleAnimation{ Duration = new Duration(TimeSpan.FromSeconds(Duration)), From = transform.ScaleX, To = 1 }; Storyboard.SetTarget(scaleAnimation, target); Storyboard.SetTargetProperty(scaleAnimation, "(UIElement.RenderTransform).(CompositeTransform.ScaleX)"); sb.Children.Add(scaleAnimation); scaleAnimation = new DoubleAnimation { Duration = new Duration(TimeSpan.FromSeconds(Duration)), From = transform.ScaleX, To = 1 }; Storyboard.SetTarget(scaleAnimation, target); Storyboard.SetTargetProperty(scaleAnimation, "(UIElement.RenderTransform).(CompositeTransform.ScaleY)"); sb.Children.Add(scaleAnimation); //transform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleAnimation); //transform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleAnimation); sb.Begin(); }
public TileRenderer(Canvas canvas, string displayText, Tile tile) { storyboard = new Storyboard(); Tile = tile; this.canvas = canvas; Width = DefaultWidth; Height = DefaultHeight; rectangle = new Rectangle { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Stroke = new SolidColorBrush(Colors.Black), Fill = new SolidColorBrush(Colors.WhiteSmoke) }; Children.Add(rectangle); text = new TextBlock { Text = displayText, HorizontalAlignment = HorizontalAlignment.Stretch, TextAlignment = TextAlignment.Center, FontSize = 36, Foreground = new SolidColorBrush(Colors.Black), FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, 26, 0, 26) }; Children.Add(text); canvas.Children.Add(this); SetPosition(); tile.PositionChanged += UpdatePosition; }
/// <summary> /// Create a <see cref="Storyboard"/> to be used to animate the view, /// based on the animation configuration supplied at initialization /// time and the new view position and size. /// </summary> /// <param name="view">The view to create the animation for.</param> /// <param name="dimensions">The view dimensions.</param> protected override IObservable<Unit> CreateAnimationCore(FrameworkElement view, Dimensions dimensions) { var fromValue = IsReverse ? 1.0 : 0.0; var toValue = IsReverse ? 0.0 : 1.0; var animatedProperty = AnimatedProperty; if (animatedProperty.HasValue) { var storyboard = new Storyboard(); var @finally = default(Action); switch (animatedProperty.Value) { case AnimatedPropertyType.Opacity: view.Opacity = fromValue; storyboard.Children.Add(CreateOpacityAnimation(view, fromValue, toValue)); @finally = () => view.Opacity = toValue; break; case AnimatedPropertyType.ScaleXY: // TODO: implement this layout animation option throw new NotImplementedException(); default: throw new InvalidOperationException( "Missing animation for property: " + animatedProperty.Value); } return new StoryboardObservable(storyboard, @finally); } throw new InvalidOperationException( "Missing animated property from the animation configuration."); }
public void AnimateVertexForward(VertexControl target) { var transform = CustomHelper.GetScaleTransform(target); if (transform == null) { target.RenderTransform = new ScaleTransform(); transform = target.RenderTransform as ScaleTransform; if (CenterScale) target.RenderTransformOrigin = new Point(.5, .5); else target.RenderTransformOrigin = new Point(0, 0); } var sb = new Storyboard(); var scaleAnimation = new DoubleAnimation { Duration = new Duration(TimeSpan.FromSeconds(Duration)), From = 1, To = ScaleTo }; Storyboard.SetTarget(scaleAnimation, target); Storyboard.SetTargetProperty(scaleAnimation, "(UIElement.RenderTransform).(CompositeTransform.ScaleX)"); sb.Children.Add(scaleAnimation); scaleAnimation = new DoubleAnimation { Duration = new Duration(TimeSpan.FromSeconds(Duration)), From = 1, To = ScaleTo }; Storyboard.SetTarget(scaleAnimation, target); Storyboard.SetTargetProperty(scaleAnimation, "(UIElement.RenderTransform).(CompositeTransform.ScaleY)"); sb.Children.Add(scaleAnimation); //transform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleAnimation); //transform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleAnimation); sb.Begin(); }
private void StartAnimation(EasingFunctionBase easingFunction) { // show the chart chartControl.Draw(easingFunction); // animation #if WPF NameScope.SetNameScope(translate1, new NameScope()); #endif var storyboard = new Storyboard(); var ellipseMove = new DoubleAnimation(); ellipseMove.EasingFunction = easingFunction; ellipseMove.Duration = new Duration(TimeSpan.FromSeconds(AnimationTimeSeconds)); ellipseMove.From = 0; ellipseMove.To = 460; #if WPF Storyboard.SetTargetName(ellipseMove, nameof(translate1)); Storyboard.SetTargetProperty(ellipseMove, new PropertyPath(TranslateTransform.XProperty)); #else Storyboard.SetTarget(ellipseMove, translate1); Storyboard.SetTargetProperty(ellipseMove, "X"); #endif ellipseMove.BeginTime = TimeSpan.FromSeconds(0.5); // start animation in 0.5 seconds ellipseMove.FillBehavior = FillBehavior.HoldEnd; // keep position after animation storyboard.Children.Add(ellipseMove); #if WPF storyboard.Begin(this); #else storyboard.Begin(); #endif }
//public LoginPageViewModel vm { get; private set; } public LoginPage() { this.InitializeComponent(); DataContextChanged += LoginPage_DataContextChanged; _toRegSb = new Storyboard(); Duration duration = new Duration(TimeSpan.FromSeconds(0.2)); _logspda = new DoubleAnimation() { From = 0, To = -FrameWidth, AutoReverse = false, Duration = duration }; _regspda = new DoubleAnimation() { From = FrameWidth, To = 0, AutoReverse = false, Duration = duration }; Storyboard.SetTargetProperty(_regspda, "(UIElement.RenderTransform).(CompositeTransform.TranslateX)"); Storyboard.SetTargetProperty(_logspda, "(UIElement.RenderTransform).(CompositeTransform.TranslateX)"); Storyboard.SetTarget(_logspda, logSP); Storyboard.SetTarget(_regspda, regSP); _toRegSb.Children.Add(_regspda); _toRegSb.Children.Add(_logspda); Rect rect = new Rect(0, 0, FrameWidth, 300); RectangleGeometry reo = new RectangleGeometry(); reo.Rect = rect; this.infoBorder.Clip = reo; }
public EventToken(Timeline animation, Storyboard storyboard) { _Children = new Dictionary<IAnimator, TimeSpan?>(); _Animation = animation; _Animation.Completed += AnimationEventHandler; TokenStoryboard = storyboard; }
private void UIElement_OnPointerEntered(object sender, PointerRoutedEventArgs e) { var border = (Border)sender; // Somehow ZIndex doesn't work in the UniformGrid // Perhaps if Jupiter had a method called Panel.GetVisualChild available to override... // See: http://blog.pixelingene.com/2007/12/controlling-z-index-of-children-in-custom-controls/ //Canvas.SetZIndex(border, ++_maxZIndex); var sb = new Storyboard(); var a1 = new DoubleAnimation(); a1.Duration = TimeSpan.FromSeconds(0.2); a1.To = 0.9; a1.EasingFunction = new PowerEase { Power = 2, EasingMode = EasingMode.EaseOut }; Storyboard.SetTarget(a1, border.RenderTransform); Storyboard.SetTargetProperty(a1, "ScaleX"); sb.Children.Add(a1); var a2 = new DoubleAnimation(); a2.Duration = TimeSpan.FromSeconds(0.2); a2.To = 0.9; a2.EasingFunction = new PowerEase { Power = 2, EasingMode = EasingMode.EaseOut }; Storyboard.SetTarget(a2, border.RenderTransform); Storyboard.SetTargetProperty(a2, "ScaleY"); sb.Children.Add(a2); sb.Begin(); }
public static Storyboard CreateDoubleSB(DependencyObject dpnObj, string property, double secondTime, Double from, Double to, EasingMode em) { //<Storyboard x:Name="Storyboard1"> // <DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="border"> // <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/> // </DoubleAnimationUsingKeyFrames> //</Storyboard> DoubleAnimationUsingKeyFrames daKeyFrame = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame edKeyFrame = new EasingDoubleKeyFrame(); edKeyFrame.KeyTime = TimeSpan.FromSeconds(secondTime); edKeyFrame.Value = to; CircleEase ce = new CircleEase(); ce.EasingMode = em; edKeyFrame.EasingFunction = ce; daKeyFrame.KeyFrames.Add(edKeyFrame); daKeyFrame.EnableDependentAnimation = true; Storyboard.SetTarget(daKeyFrame, dpnObj); Storyboard.SetTargetProperty(daKeyFrame, property); Storyboard sb = new Storyboard(); sb.Children.Add(daKeyFrame); return sb; }
static public void AnimateOpacity(FrameworkElement element, double start, double end, double duration) { element.Opacity = 0; Duration animationDuration = new Duration(TimeSpan.FromSeconds(duration)); DoubleAnimation opacityAnimation = new DoubleAnimation(); opacityAnimation.Duration = animationDuration; opacityAnimation.From = start; opacityAnimation.To = end; Storyboard sb = new Storyboard(); sb.Duration = animationDuration; sb.Children.Add(opacityAnimation); Storyboard.SetTarget(opacityAnimation, element); // Set the X and Y properties of the Transform to be the target properties // of the two respective DoubleAnimations. Storyboard.SetTargetProperty(opacityAnimation, "Opacity"); // Begin the animation. sb.Begin(); }
public void MoveTo(Point from, Point to, EventHandler<object> completed = null) { TranslateTransform trans = new TranslateTransform(); _participant.Name = "MyTarget"; _participant.RenderTransform = trans; DoubleAnimation anim1 = new DoubleAnimation() { From = from.X, To = to.X, Duration = TimeSpan.FromMilliseconds(Utility.GAME_TICK_MS - 1) }; DoubleAnimation anim2 = new DoubleAnimation() { From = from.Y, To = to.Y, Duration = TimeSpan.FromMilliseconds(Utility.GAME_TICK_MS - 1) }; Storyboard.SetTarget(anim1, _participant); Storyboard.SetTargetName(anim1, _participant.Name); Storyboard.SetTargetProperty(anim1, "(Canvas.Left)"); Storyboard.SetTarget(anim2, _participant); Storyboard.SetTargetName(anim2, _participant.Name); Storyboard.SetTargetProperty(anim2, "(Canvas.Top)"); Storyboard sb = new Storyboard(); sb.Children.Add(anim1); sb.Children.Add(anim2); if (completed == null) sb.Completed += (object sender, object e) => { }; else sb.Completed += completed; sb.Begin(); }
private void GetStoryBoardControl(string name) { if (this.storyBoard == null) { this.storyBoard = this.GetTemplateChild(name) as Storyboard; } }
private void FadeIn() { if (_Running) { DoubleAnimation fadeIn = new DoubleAnimation(); fadeIn.From = 0.0; fadeIn.To = 1; fadeIn.Duration = new Duration(TimeSpan.FromSeconds(2)); fadeIn.BeginTime = TimeSpan.FromSeconds(2); Storyboard sb = new Storyboard(); Storyboard.SetTarget(fadeIn, _Control); Storyboard.SetTargetProperty(fadeIn, "Opacity"); sb.Children.Add(fadeIn); _Control.Resources.Clear(); _Control.Resources.Add("FaderEffect", sb); sb.Completed += this.OnFadeInCompleted; sb.Begin(); } }
private void VEManipulationEndX( object sender, ManipulationCompletedRoutedEventArgs e ) { double dv = e.Cumulative.Translation.X.Clamp( MinVT, MaxVT ); ContentAway?.Stop(); if ( VT < dv ) { ContentAway = new Storyboard(); SimpleStory.DoubleAnimation( ContentAway, CGTransform, "TranslateX" , CGTransform.TranslateX , MainSplitView.ActualWidth ); ContentBeginAwayX( false ); } else if ( dv < -VT ) { ContentAway = new Storyboard(); SimpleStory.DoubleAnimation( ContentAway, CGTransform, "TranslateX" , CGTransform.TranslateX , -MainSplitView.ActualWidth ); ContentBeginAwayX( true ); } else { ContentRestore.Begin(); } }
private void InitializeControl() { try { if (root == null) { root = (Canvas)GetTemplateChild("root"); layerStoryboard = (Storyboard)root.Resources["layerStoryboard"]; layerAnimationX = (DoubleAnimation)layerStoryboard.Children[0]; layerAnimationY = (DoubleAnimation)layerStoryboard.Children[1]; layerState = new LayerState(SensitivityX, SensitivityY); Conductor.Beat += Conductor_Beat; rootParent = (Canvas)this.Parent; //rootParent.PointerPressed += rootParent_PointerPressed; rootParent.ManipulationDelta += rootParent_ManipulationDelta; rootParent.ManipulationMode = this.ManipulationMode; // &ManipulationModes.TranslateY; } } catch { } }
/// <summary> /// Begint een nieuw storyboard dat het menu grid uitschuift of inschuift naar een positieve (zichtbaar) of negatieve (onzichtbaar) margin. /// </summary> public void BeginMenuAnimatie() { Storyboard storyboard = new Storyboard(); TranslateTransform beweegTransformatie = new TranslateTransform(); menu.RenderTransform = beweegTransformatie; DoubleAnimation verplaatsMenuAnimatie = new DoubleAnimation(); verplaatsMenuAnimatie.Duration = new Duration(TimeSpan.FromSeconds(0.15)); if (btnHideShow.Content.Equals(">")) { verplaatsMenuAnimatie.To = 303; verplaatsMenuAnimatie.From = 0; btnHideShow.Content = "<"; } else { verplaatsMenuAnimatie.To = 0; verplaatsMenuAnimatie.From = 303; btnHideShow.Content = ">"; } storyboard.Children.Add(verplaatsMenuAnimatie); Storyboard.SetTarget(verplaatsMenuAnimatie, beweegTransformatie); Storyboard.SetTargetProperty(verplaatsMenuAnimatie, "X"); storyboard.Begin(); }
/// <summary> /// Starts new animation from given images. /// </summary> /// <param name="imageNames">Names of images in assets folder</param> /// <param name="interval">Interval between animation frames</param> public void StartAnimation(IEnumerable<string> imageNames, TimeSpan interval) { Storyboard storyboard = new Storyboard(); ObjectAnimationUsingKeyFrames animation = new ObjectAnimationUsingKeyFrames(); // We're going to animate image inside our control. Storyboard.SetTarget(animation, image); // Animation relies on changing value of property source Storyboard.SetTargetProperty(animation, nameof(image.Source)); TimeSpan currentInterval = TimeSpan.FromMilliseconds(0); foreach (string imageName in imageNames) { // We're creating individual frames from given images ObjectKeyFrame keyFrame = new DiscreteObjectKeyFrame(); keyFrame.Value = CreateImageFromAssets(imageName); keyFrame.KeyTime = currentInterval; animation.KeyFrames.Add(keyFrame); currentInterval = currentInterval.Add(interval); } // We're configuring our storyboard which will play animations storyboard.RepeatBehavior = RepeatBehavior.Forever; storyboard.AutoReverse = true; storyboard.Children.Add(animation); storyboard.Begin(); }
internal void Start(PlotElement pe) { int length = ((IDataSeriesInfo)pe.DataPoint.Series).GetValues().GetLength(1); if (SymbolStyle != null) { pe.Style = SymbolStyle; } if (Storyboard != null) { Windows.UI.Xaml.Media.Animation.Storyboard storyboard = Storyboard.DeepClone <Windows.UI.Xaml.Media.Animation.Storyboard>(); if (storyboard != null) { foreach (Timeline timeline in Storyboard.Children) { Timeline element = timeline.DeepClone <Timeline>(); string targetProperty = Windows.UI.Xaml.Media.Animation.Storyboard.GetTargetProperty(timeline); Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(element, targetProperty); double indexDelay = GetIndexDelay(timeline); if (indexDelay != 0.0) { double num3 = ((pe.DataPoint.PointIndex * indexDelay) * element.Duration.TimeSpan.TotalSeconds) / ((double)length); element.BeginTime = new TimeSpan?(TimeSpan.FromSeconds(num3)); } storyboard.Children.Add(element); } Windows.UI.Xaml.Media.Animation.Storyboard.SetTarget(storyboard, pe); storyboard.Begin(); } } }
public static void Animate(this UIElement element, double from, double to, double fullDistance) { if (element == null) { throw new ArgumentNullException("element"); } var transform = new TranslateTransform(); element.RenderTransform = transform; var xAnimation = new DoubleAnimation { From = from, Duration = TimeSpan.FromMilliseconds(GetAnimationSpeed(from, to, fullDistance)), To = to, EnableDependentAnimation = true, EasingFunction = new SineEase() { EasingMode = EasingMode.EaseOut } }; Storyboard.SetTarget(xAnimation, transform); Storyboard.SetTargetProperty(xAnimation, "X"); var storyboard = new Storyboard(); storyboard.Children.Add(xAnimation); storyboard.Begin(); }
public void SwitchMode(Storyboard sb = null) { var shouldBegin = sb == null; if(sb == null) sb = new Storyboard(); var da = new DoubleAnimation() { EnableDependentAnimation = true, Duration = new Duration(TimeSpan.FromMilliseconds(200)), EasingFunction = new QuarticEase() { EasingMode = EasingMode.EaseInOut } }; Storyboard.SetTarget(da, RootGrid); Storyboard.SetTargetProperty(da, "(FrameworkElement.Width)"); // 处于宽模式 if (_isWide) { da.From = RootGrid.ActualWidth; da.To = 30;// TODO value } // 处于窄模式 else { da.From = RootGrid.ActualWidth; da.To = ItemsListView.ActualWidth; } _isWide = !_isWide; sb.Children.Add(da); if(shouldBegin) sb.Begin(); }
public static void changeColor(Storyboard storyboard, Color color) { ColorAnimationUsingKeyFrames colorValue = storyboard.Children[1] as ColorAnimationUsingKeyFrames; ColorKeyFrameCollection collection = colorValue.KeyFrames; collection[1].Value = color; }
public InfiniteProgress() { this.InitializeComponent(); _storyboard = new Storyboard(); _storyboard.Completed += Sb_Completed; Loaded += InfiniteProgress_Loaded; }
/// <summary> /// Metodo costruttore /// </summary> public TiltEffect() { tilt_down = new Storyboard(); tilt_down.Children.Add(new PointerDownThemeAnimation()); tilt_up = new Storyboard(); tilt_up.Children.Add(new PointerUpThemeAnimation()); }
public static void BeginAnimation(this DependencyObject target, Timeline animation, string path) { var sb = new Storyboard(); Storyboard.SetTarget(animation, target); Storyboard.SetTargetProperty(animation, path); sb.Children.Add(animation); sb.Begin(); }
private static void BeginAnimation(DependencyObject obj, string property, Timeline animation) { Storyboard.SetTargetProperty(animation, property); Storyboard.SetTarget(animation, obj); var storyboard = new Storyboard(); storyboard.Children.Add(animation); storyboard.Begin(); }
protected override void ApplyTargetProperties(DependencyObject target, Storyboard animation) { var fe = (FrameworkElement)target; TranslateTransform tt = fe.RenderTransform as TranslateTransform; if (tt == null) { fe.RenderTransform = tt = new TranslateTransform(); } var da = (DoubleAnimation)animation.Children[0]; Storyboard.SetTarget(da, tt); if (Direction == DirectionOfMotion.RightToLeft || Direction == DirectionOfMotion.LeftToRight) { Storyboard.SetTargetProperty(da, "X"); if (Mode == AnimationMode.In) { da.From = Direction == DirectionOfMotion.LeftToRight ? -fe.ActualWidth : fe.ActualWidth; da.To = 0; } else { da.From = 0; da.To = Direction == DirectionOfMotion.LeftToRight ? fe.ActualWidth : -fe.ActualWidth; } } else { Storyboard.SetTargetProperty(da, "Y"); if (Mode == AnimationMode.In) { da.From = Direction == DirectionOfMotion.TopToBottom ? -fe.ActualHeight : fe.ActualHeight; da.To = 0; } else { da.From = 0; da.To = Direction == DirectionOfMotion.TopToBottom ? fe.ActualHeight : -fe.ActualHeight; } } }
private Storyboard GetStoryboard(Image target) { Storyboard storyboard = new Storyboard(); if (target.Source != null) { Storyboard.SetTarget(storyboard, target.RenderTransform); var bitmapSource = (Windows.UI.Xaml.Media.Imaging.BitmapSource)(target.Source); DoubleAnimationUsingKeyFrames anim; QuadraticEase easingFunction = new QuadraticEase() { EasingMode = EasingMode.EaseInOut }; //if (bitmapSource.PixelHeight > bitmapSource.PixelWidth) { anim = new DoubleAnimationUsingKeyFrames(); //ANIM on Y var minYValue = 0; var maxYValue = Math.Abs(this.ActualHeight - bitmapSource.PixelHeight); var offset = (this.ActualHeight > maxYValue) ? maxYValue / 2 : 0.0; Storyboard.SetTargetProperty(anim, "TranslateY"); anim.AutoReverse = true; anim.RepeatBehavior = RepeatBehavior.Forever; var durationOnY = rnd.Next(9, 19) * Math.Max(maxYValue / 150, 1); anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(0), Value = minYValue + offset, EasingFunction = easingFunction }); anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(durationOnY), Value = -maxYValue + offset, EasingFunction = easingFunction }); anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(durationOnY * 2), Value = minYValue + offset, EasingFunction = easingFunction }); storyboard.Children.Add(anim); } //if (bitmapSource.PixelWidth > bitmapSource.PixelHeight) { var minXValue = 0; var maxXValue = Math.Abs(this.ActualWidth - bitmapSource.PixelWidth); var offsetX = (this.ActualWidth > bitmapSource.PixelWidth) ? maxXValue / 2 : 0.0; anim = new DoubleAnimationUsingKeyFrames(); Storyboard.SetTargetProperty(anim, "TranslateX"); anim.AutoReverse = true; anim.RepeatBehavior = RepeatBehavior.Forever; var durationOnX = rnd.Next(9, 19) * Math.Max(1, maxXValue / 150); easingFunction = new QuadraticEase() { EasingMode = EasingMode.EaseInOut }; anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(0), Value = minXValue + offsetX, EasingFunction = easingFunction }); anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(durationOnX), Value = -maxXValue + offsetX, EasingFunction = easingFunction }); anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(durationOnX * 2), Value = minXValue, EasingFunction = easingFunction }); storyboard.Children.Add(anim); } } return storyboard; }
private static void ShowUpAnimation(UIElement element) { var animation = new PointerUpThemeAnimation(); Storyboard.SetTarget(animation, element); var storyboard = new Storyboard(); storyboard.Children.Add(animation); storyboard.Begin(); }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); jumpAnimation = GetTemplateChild(JumpAnimationName) as Storyboard; pointsStackPanel = GetTemplateChild(PointsStackPanelName) as StackPanel; if (jumpAnimation != null) jumpAnimation.Completed += jumpAnimation_Completed; }
public SearchTextBox() { DefaultStyleKey = typeof(TextBox); _storyboard = new Storyboard() { Duration = TimeSpan.FromMilliseconds(250) }; _storyboard.Completed += _storyboard_Completed; }
/// <summary> /// 创建动画 /// </summary> public static DoubleAnimation CreatAnimation(DependencyObject obj, Storyboard storyboard, string path, int duration, EasingFunctionBase easing = null) { DoubleAnimation da = new DoubleAnimation(); da.EasingFunction = easing; da.Duration = TimeSpan.FromMilliseconds(duration); Storyboard.SetTarget(da, obj); Storyboard.SetTargetProperty(da, path); storyboard.Children.Add(da); return da; }
void animateimage(double to, int index) { Windows.UI.Xaml.Media.Animation.Storyboard story = new Windows.UI.Xaml.Media.Animation.Storyboard(); Windows.UI.Xaml.Media.Animation.DoubleAnimation animation = new Windows.UI.Xaml.Media.Animation.DoubleAnimation(); animation.Duration = TimeSpan.FromMilliseconds(650); story.Children.Add(animation); Windows.UI.Xaml.Media.Animation.CubicEase ease1 = new Windows.UI.Xaml.Media.Animation.CubicEase(); //ease1.EasingMode = Windows.UI.Xaml.Media.Animation.EasingMode.EaseIn ; animation.EnableDependentAnimation = true; animation.EasingFunction = ease1; animation.To = to; Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(animation, "Opacity"); Windows.UI.Xaml.Media.Animation.Storyboard.SetTarget(animation, _imagelist[index]); story.Begin(); }
internal static string GetTimelineTargetFullName(this Timeline t) { return(Storyboard.GetTargetName(t) + "." + Storyboard.GetTargetProperty(t)); }