Can Storyboard contain multiple animations targeting same property?
Hi, my game includes multiple animations in a single storyboard, some of which target the same property (although not at the same time). The idea of using a single storyboard is to be able to pause etc. I think this all works fine in WPF, but in Noesis, only the last animation can run.
To illustrate this problem below is a simple example:
To illustrate this problem below is a simple example:
Code: Select all
var storyboard = new Storyboard();
var duration = new Duration(TimeSpan.Parse("0:0:1"));
var x1Animation = new DoubleAnimation() {
To = 800,
Duration = duration
};
var y1Animation = new DoubleAnimation() {
To = 800,
Duration = duration
};
Storyboard.SetTarget(x1Animation, demo1KingCard);
Storyboard.SetTarget(y1Animation, demo1KingCard);
Storyboard.SetTargetProperty(x1Animation, new PropertyPath(Canvas.LeftProperty));
Storyboard.SetTargetProperty(y1Animation, new PropertyPath(Canvas.TopProperty));
storyboard.Children.Add(x1Animation);
storyboard.Children.Add(y1Animation);
var beginTime = TimeSpan.Parse("0:0:1");
var x2Animation = new DoubleAnimation() {
BeginTime = beginTime,
To = 200,
Duration = duration
};
var y2Animation = new DoubleAnimation() {
BeginTime = beginTime,
To = 200,
Duration = duration
};
Storyboard.SetTarget(x2Animation, demo1KingCard);
Storyboard.SetTarget(y2Animation, demo1KingCard);
Storyboard.SetTargetProperty(x2Animation, new PropertyPath(Canvas.LeftProperty));
Storyboard.SetTargetProperty(y2Animation, new PropertyPath(Canvas.TopProperty));
storyboard.Children.Add(x2Animation);
storyboard.Children.Add(y2Animation);
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Can Storyboard contain multiple animations targeting same property?
I was able to reproduce the problem, it is a bug, Could you please report it in our bugtracker?
Meanwhile, is it an option for you to use an equivalent animation with keyframes?, like this:
Meanwhile, is it an option for you to use an equivalent animation with keyframes?, like this:
Code: Select all
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="demo1KingCard" Storyboard.TargetProperty="Canvas.LeftProperty">
<LinearDoubleKeyFrame KeyTime="0:0:1" Value="800"/>
<LinearDoubleKeyFrame KeyTime="0:0:2" Value="200"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>Re: Can Storyboard contain multiple animations targeting same property?
@sfernandez I have submitted the ticket(https://bugs.noesisengine.com/view.php?id=1124)
Thanks for your advice. Since I need to combine some individual animations/storyboard to build a whole storyboard in code, so using keyframe is not easier. My current solution is to write some custom code which control individual storyboard manually.
Thanks for your advice. Since I need to combine some individual animations/storyboard to build a whole storyboard in code, so using keyframe is not easier. My current solution is to write some custom code which control individual storyboard manually.
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Can Storyboard contain multiple animations targeting same property?
Thanks for reporting, we will fix it as soon as possible.
Who is online
Users browsing this forum: No registered users and 4 guests