BartekW
Topic Author
Posts: 53
Joined: 24 Mar 2021, 14:33

Storyboard c++

21 Apr 2021, 10:37

Hey, how can I have control of storyboard C++? Can I have any callbacks methods when finished? Or started?

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 2255
Joined: 22 Dec 2011, 19:20

Re: Storyboard c++

21 Apr 2021, 11:54

You can register to the Completed event of the Storyboard:
Storyboard* storyboard = FindResource<Storyboard*>("SomeAnimation");
storyboard->Completed() += [](BaseComponent*, const TimelineEventArgs&)
{
  // do something
};
storyboard->Begin(this);
 
BartekW
Topic Author
Posts: 53
Joined: 24 Mar 2021, 14:33

Re: Storyboard c++

21 Apr 2021, 13:09

Ok thanks its what I needed exactly, but now I have some WPF question.
<Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="-400"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="300"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
Why does that code not moving my object? Its change its opacity but doesnt move :/
 
User avatar
sfernandez
Site Admin
Posts: 2255
Joined: 22 Dec 2011, 19:20

Re: Storyboard c++

21 Apr 2021, 13:16

Probably because your object doesn't have a TranslateTransform set in its RenderTransform property.
<Rectangle>
  <Rectangle.RenderTransform>
    <TranslateTransform/>
  </Rectangle.RenderTransform>
</Rectangle>
 
BartekW
Topic Author
Posts: 53
Joined: 24 Mar 2021, 14:33

Re: Storyboard c++

21 Apr 2021, 13:30

Probably because your object doesn't have a TranslateTransform set in its RenderTransform property.
<Rectangle>
  <Rectangle.RenderTransform>
    <TranslateTransform/>
  </Rectangle.RenderTransform>
</Rectangle>
Yes, thats was it! I tested it on something other Thanks
 
User avatar
sfernandez
Site Admin
Posts: 2255
Joined: 22 Dec 2011, 19:20

Re: Storyboard c++

21 Apr 2021, 14:13

Great, marking this as solved.

Who is online

Users browsing this forum: No registered users and 1 guest