This project is read-only.

How can I control AnimationGroup and Animations in the group in c#?

Mar 25, 2013 at 6:24 PM

I'm trying to control animations I wrote in xaml file. But it seems that all the animations I create by scene.FindName<T>("string") method turns out to be null.

c# code
var t_a = scene.FindName<Sprite>("t1");
            var i_a = scene.FindName<Transformable>("Inks");

            AnimationPlayer tg = t_a.Animations;
            AnimationGroup ag = scene.FindName<AnimationGroup>("t1_ani");

The Scene code
<Group Name="Title">
        <Sprite Name="t1" Texture="{ContentReference Textures/title}" Position="0, 10" Scale="0.1, 0.1" />
            <AnimationGroup Name="t1_ani">
                <SingleAnimation Name="t11" TargetProperty="t1.Alpha" From="0" To="1" Duration="00:00:01" Curve="{x:Static Curves.Sin}" Repeat="1"/>
And I really hope that you can provide a downloadable project of a short playable scene to help us better understand how to use the engine.

Thanks so much!
Mar 26, 2013 at 1:06 AM
Here's the confusion, scene.findname is unable to find everything that has a name, but just those descend nodes that are attached to the scene graph. So you should be using scene.findname("title")"t1_anim") in your case.

it's nice to have a small playable game provided along with the engine, thanks for the feedback.