Opacity の変更
private void ChangeOpacity(Label label)
{
string name = "labelOpacity" + num++;
this.RegisterName(name, label);
label.RenderTransform = label.translateTransform;
DoubleAnimation myDoubleAnimation = new DoubleAnimation();
myDoubleAnimation.From = 1.0;
myDoubleAnimation.To = 0.0;
myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));
myDoubleAnimation.AutoReverse = true;
myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
Storyboard.SetTargetName(myDoubleAnimation, name);
Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Label.OpacityProperty));
myStoryboard1.Children.Add(myDoubleAnimation);
}
フォントサイズの変更
private void ChangeFontSize(Label label)
{
string name = "labelFontSize" + num++;
this.RegisterName(name, label);
label.RenderTransform = label.translateTransform;
DoubleAnimation myDoubleAnimation = new DoubleAnimation();
myDoubleAnimation.From = 12.0;
myDoubleAnimation.To = 50.0;
myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));
myDoubleAnimation.AutoReverse = true;
myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
Storyboard.SetTargetName(myDoubleAnimation, name);
Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Label.FontSizeProperty));
myStoryboard1.Children.Add(myDoubleAnimation);
}
Storyboard myStoryboard1 = new Storyboard();
ChangeOpacity(label1);
ChangeFontSize(label1);
myStoryboard1.Begin(label1);