Page 1 of 1

DoubleAnimation on RotateTransform.Angle not working on Unreal

Posted: 14 Jun 2022, 13:30
by lehoang03an
Hello,
In this xaml, I try to rotate an image when control is loaded
<ControlTemplate x:Key="PlayerInfoPanel" TargetType="{x:Type ContentControl}">
            <ControlTemplate.Resources>
                <Storyboard x:Key="EndlessRotate">
                    <DoubleAnimation
                        Storyboard.TargetProperty="(RenderTransform).(RotateTransform.Angle)" Storyboard.TargetName="Loading"
                        To="360" Duration="0:0:1.5" RepeatBehavior="Forever"/>
                </Storyboard>
            </ControlTemplate.Resources>
            <Grid>
                <Image x:Name="Loading" Visibility="Visible" 
                       Source="Dummy_Loading.png" Width="40" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,14,0" RenderTransformOrigin="0.5,0.5" >
                    <Image.RenderTransform>
                        <RotateTransform/>
                    </Image.RenderTransform>
                </Image></Grid>
            <ControlTemplate.Triggers>
                <EventTrigger RoutedEvent="Loaded">
                    <BeginStoryboard Storyboard="{StaticResource EndlessRotate}" x:Name="AnimationBeginStoryboard"/>
                </EventTrigger>
            </ControlTemplate.Triggers>
It works in Blend, but when I import it to Unreal, it shows this error:
Unable to convert '(RenderTransform).(RotateTransform.Angle)' to a valid value for property DoubleAnimation.TargetProperty.
LogNoesis: Warning: Target property not set in timeline
Can you tell me what is wrong here?

Re: DoubleAnimation on RotateTransform.Angle not working on Unreal

Posted: 14 Jun 2022, 15:08
by sfernandez
When using parenthesis syntax to reference a property you have to specify the owner type and the property name in Noesis:
<DoubleAnimation
  Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
  Storyboard.TargetName="Loading"
  To="360" Duration="0:0:1.5" RepeatBehavior="Forever"/>
The parenthesis syntax is required for attached properties, but the rest can be referenced by just the name, so the following will also work:
Storyboard.TargetProperty="RenderTransform.Angle"

Re: DoubleAnimation on RotateTransform.Angle not working on Unreal

Posted: 15 Jun 2022, 06:02
by lehoang03an
Thanks, it works. Is there any advantage or usecase using parenthesis syntax?

Re: DoubleAnimation on RotateTransform.Angle not working on Unreal

Posted: 15 Jun 2022, 10:39
by sfernandez
It works in Blend, but when I import it to Unreal, it shows this error
I have added ticket #2361 to our bugtracker because using "(RenderTransform)" to reference a property in WPF it is supported and we need to fix it.
Is there any advantage or usecase using parenthesis syntax?
No, both syntaxes are equivalent. As I said the only specific scenario where using parenthesis is strictly required is for attached properties, like in
"(Canvas.Left)".