weilitao
Topic Author
Posts: 22
Joined: 23 Feb 2016, 10:43

Can Storyboard contain multiple animations targeting same property?

11 Jul 2017, 05:58

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:
            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);
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: Can Storyboard contain multiple animations targeting same property?

14 Jul 2017, 02:46

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:
<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>
 
weilitao
Topic Author
Posts: 22
Joined: 23 Feb 2016, 10:43

Re: Can Storyboard contain multiple animations targeting same property?

14 Jul 2017, 03:33

@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.
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: Can Storyboard contain multiple animations targeting same property?

18 Jul 2017, 11:29

Thanks for reporting, we will fix it as soon as possible.

Who is online

Users browsing this forum: Google [Bot] and 2 guests