Animated Rectangle width with Easing
//Easing effect for Object
var ease = new PowerEase { EasingMode = EasingMode.EaseOut };
// Create Storyboard for animation
Storyboard storyboard = new Storyboard();
DoubleAnimation doubleAnimatoin = new DoubleAnimation();
doubleAnimatoin.EasingFunction = ease;
// "objectName " is name of object to be animated.
doubleAnimatoin.From = objectName.Width;
doubleAnimatoin.To = 100;
doubleAnimatoin.Duration = new Duration(TimeSpan.FromMilliseconds(400));
Storyboard.SetTarget(doubleAnimatoin, objectName);
Storyboard.SetTargetProperty(doubleAnimatoin, new PropertyPath("(objectName.Width)"));
storyboard.Children.Add(doubleAnimatoin);
storyboard.Begin();
- Amey Raut
//Easing effect for Object
var ease = new PowerEase { EasingMode = EasingMode.EaseOut };
// Create Storyboard for animation
Storyboard storyboard = new Storyboard();
DoubleAnimation doubleAnimatoin = new DoubleAnimation();
doubleAnimatoin.EasingFunction = ease;
// "objectName " is name of object to be animated.
doubleAnimatoin.From = objectName.Width;
doubleAnimatoin.To = 100;
doubleAnimatoin.Duration = new Duration(TimeSpan.FromMilliseconds(400));
Storyboard.SetTarget(doubleAnimatoin, objectName);
Storyboard.SetTargetProperty(doubleAnimatoin, new PropertyPath("(objectName.Width)"));
storyboard.Children.Add(doubleAnimatoin);
storyboard.Begin();
- Amey Raut
No comments:
Post a Comment