Skip to content

[WASM] AnimationTimeline jumps with BeginTime #4053

Closed

Description

@Avid29

Current behavior

BeginTime is chopped off duration, ending in animation jump

Expected behavior

Timeline's should take place with the full duration after waiting the BeginTime

How to reproduce it (as minimally and precisely as possible)

Add the following to MainPage.xaml

    <Page.Resources>
        <Storyboard x:Name="EnterActive">
            <DoubleAnimation Storyboard.TargetName="Rec1Transform" Storyboard.TargetProperty="ScaleX"
                                             BeginTime="0:0:0" Duration="0:0:.4" To="1.5">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="Rec1Transform" Storyboard.TargetProperty="ScaleY"
                                             BeginTime="0:0:0" Duration="0:0:.4" To="1.5">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="Rec1Transform" Storyboard.TargetProperty="TranslateX"
                                             BeginTime="0:0:0" Duration="0:0:.4" To="200">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="Rec2Transform" Storyboard.TargetProperty="ScaleX"
                                             BeginTime="0:0:0.1" Duration="0:0:.4" To="1.5">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="Rec2Transform" Storyboard.TargetProperty="ScaleY"
                                             BeginTime="0:0:0.1" Duration="0:0:.4" To="1.5">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="Rec2Transform" Storyboard.TargetProperty="TranslateX"
                                             BeginTime="0:0:0.1" Duration="0:0:.4" To="200">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>
        <Storyboard x:Name="LeaveActive">
            <DoubleAnimation Storyboard.TargetName="Rec1Transform" Storyboard.TargetProperty="ScaleX"
                                             BeginTime="0:0:0.1" Duration="0:0:.4" To="1">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="Rec1Transform" Storyboard.TargetProperty="ScaleY"
                                             BeginTime="0:0:0.1" Duration="0:0:.4" To="1">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="Rec1Transform" Storyboard.TargetProperty="TranslateX"
                                             BeginTime="0:0:0.1" Duration="0:0:.4" To="0">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="Rec2Transform" Storyboard.TargetProperty="ScaleX"
                                             BeginTime="0:0:0.1" Duration="0:0:.4" To="1">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="Rec2Transform" Storyboard.TargetProperty="ScaleY"
                                             BeginTime="0:0:0.1" Duration="0:0:.4" To="1">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="Rec2Transform" Storyboard.TargetProperty="TranslateX"
                                             BeginTime="0:0:0.1" Duration="0:0:.4" To="0">
                <DoubleAnimation.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>
    </Page.Resources>

    <Grid Background="Black">
        <StackPanel Padding="40" HorizontalAlignment="Left" VerticalAlignment="Center">
            <Rectangle Stroke="White" Width="64" Height="64" Margin="24">
                <Rectangle.RenderTransform>
                    <CompositeTransform x:Name="Rec1Transform" ScaleX="1" ScaleY="1" TranslateX="0"/>
                </Rectangle.RenderTransform>
            </Rectangle>
            <Rectangle Stroke="White" Width="64" Height="64" Margin="24">
                <Rectangle.RenderTransform>
                    <CompositeTransform x:Name="Rec2Transform" ScaleX="1" ScaleY="1" TranslateX="0"/>
                </Rectangle.RenderTransform>
            </Rectangle>
        </StackPanel>
    </Grid>

and the following to MainPage.xaml.cs

public sealed partial class MainPage : Page
    {

        public MainPage()
        {
            this.InitializeComponent();
            BeginCycle();
        }

        private bool isactive = false;

        private void BeginCycle()
        {
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(2);
            timer.Tick += (s, e) =>
            {
                if (isactive)
                {
                    LeaveActive.Begin();
                }
                else
                {
                    EnterActive.Begin();
                }
                isactive = !isactive;
            };
            timer.Start();
        }
    }

Workaround

Don't use BeginTime

Environment

Nuget Package:

  • Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • Uno.SourceGenerationTasks
  • Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • Other:

Nuget Package Version(s):

3.0.12
3.1.0-dev.327

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates

IDE:

  • Visual Studio 2017 (version: )
  • Visual Studio 2019 (version: 16.7.2)
  • Visual Studio for Mac (version: )
  • Rider Windows (version: )
  • Rider macOS (version: )
  • Visual Studio Code (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

This is from Strix Music. Feel free to message me on Discord with any questions

Activity

  1. added
    kind/bug
    triage/untriaged
    on Sep 14, 2020
  2. Avid29 commented on Sep 14, 2020

    @Avid29
    Author

    Here's a gif of my sample in action

    2020-09-14-16-51-17

    You can see how the first animation (growing) Rectangle1 has no BeginTime and manages to complete its animation

    For the second animation (shrinking) both Rectangles have a BeginTime so neither plays the animation to completion

  3. removed
    triage/untriaged
    on Sep 17, 2020
  4. dr1rrb commented on Sep 17, 2020

    @dr1rrb
    Member

    Thanks for the report @Avid29 It's the first time I see this bug and it's really good to know since we are planning to start work on animations

    I've linked to the animation epic #3919 so we should tackle it in a near future.

  5. added
    project/animations 🎡
    on Sep 21, 2020
  6. added
    difficulty/tbd
    on Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty/tbdkind/bugproject/animations 🎡

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions