Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VisualStateTrigger are not working properly in the Playground #100

Open
1 of 5 tasks
agneszitte opened this issue Feb 6, 2020 · 6 comments
Open
1 of 5 tasks

VisualStateTrigger are not working properly in the Playground #100

agneszitte opened this issue Feb 6, 2020 · 6 comments
Labels
area/playground Categorizes an issue or PR as relevant to the Playground kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification.

Comments

@agneszitte
Copy link
Contributor

Current behavior

RenderTansform animations don't work inside the Playground but the same code is working fine in an UNO solution when testing WASM

Expected behavior

RenderTansform animations should work correctly inside the Playground

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

	<Grid>
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup>
				<VisualState>
					<VisualState.StateTriggers>
						<StateTrigger IsActive="True" />
					</VisualState.StateTriggers>
					<Storyboard>
						<!-- TEST ANIMATION TRANSLATE TRANSFORM-->
						<DoubleAnimationUsingKeyFrames  Duration="0:0:10"
														RepeatBehavior="Forever"
Storyboard.TargetName="TestTranslateTransform"
														Storyboard.TargetProperty="X">
							<LinearDoubleKeyFrame Value="-200"
												  KeyTime="0:0:0" />
							<LinearDoubleKeyFrame Value="0"
												  KeyTime="0:0:5" />
							<LinearDoubleKeyFrame Value="200"
												  KeyTime="0:0:10" />
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>

		<Rectangle Height="100"
				   Width="200"
				   Fill="Red"
				   VerticalAlignment="Center"
				   HorizontalAlignment="Center">
			<Rectangle.RenderTransform>
				<TranslateTransform x:Name="TestTranslateTransform"
									X="-200" />
			</Rectangle.RenderTransform>
		</Rectangle>
	</Grid>

Environment

Affected platform(s):

  • iOS
  • Android
  • WebAssembly (ONLY Playground)
  • Windows
  • Build tasks

Anything else we need to know?

Don't forget to add isAnimating="True" for the DataContext with this come sample.

@agneszitte agneszitte added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification. labels Feb 6, 2020
@agneszitte
Copy link
Contributor Author

agneszitte commented Mar 12, 2020

Snippet of code in the playground: https://playground.platform.uno/#edfd17fa

@agneszitte agneszitte added the area/playground Categorizes an issue or PR as relevant to the Playground label Mar 12, 2020
@agneszitte
Copy link
Contributor Author

agneszitte commented Aug 28, 2020

The previous snippet of code is still not working inside the Playground (even with the latest canary version):

<Grid>
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup>
				<VisualState>
					<VisualState.StateTriggers>
						<StateTrigger IsActive="True" />
					</VisualState.StateTriggers>
					<Storyboard>
						<!-- TEST ANIMATION TRANSLATE TRANSFORM-->
						<DoubleAnimationUsingKeyFrames  Duration="0:0:10"
														RepeatBehavior="Forever"
Storyboard.TargetName="TestTranslateTransform"
														Storyboard.TargetProperty="X">
							<LinearDoubleKeyFrame Value="-200"
												  KeyTime="0:0:0" />
							<LinearDoubleKeyFrame Value="0"
												  KeyTime="0:0:5" />
							<LinearDoubleKeyFrame Value="200"
												  KeyTime="0:0:10" />
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>

		<Rectangle Height="100"
				   Width="200"
				   Fill="Red"
				   VerticalAlignment="Center"
				   HorizontalAlignment="Center">
			<Rectangle.RenderTransform>
				<TranslateTransform x:Name="TestTranslateTransform"
									X="-200" />
			</Rectangle.RenderTransform>
		</Rectangle>
	</Grid>

But this modified version using the behaviors:DynamicAnimation.Storyboard is working correctly for the animation:

<Grid>
        <Rectangle Height="100"
                   Width="200"
                   Fill="Red"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Center">
            <Rectangle.RenderTransform>
                <TranslateTransform x:Name="TestTranslateTransform"
                                    X="-400">
                    <behaviors:DynamicAnimation.Storyboard>
                        <Storyboard>
                            <!-- TEST ANIMATION TRANSLATE TRANSFORM-->
                            <DoubleAnimationUsingKeyFrames  Duration="0:0:10"
                                                            RepeatBehavior="Forever"
                                                            Storyboard.TargetName="TestTranslateTransform"
                                                            Storyboard.TargetProperty="X">
                                <LinearDoubleKeyFrame Value="-200"
                                                    KeyTime="0:0:0" />
                                <LinearDoubleKeyFrame Value="0"
                                                    KeyTime="0:0:5" />
                                <LinearDoubleKeyFrame Value="200"
                                                    KeyTime="0:0:10" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </behaviors:DynamicAnimation.Storyboard>
                </TranslateTransform>
            </Rectangle.RenderTransform>
        </Rectangle>
</Grid>

In my opinion, we should support animation with <StateTrigger IsActive="True" /> in the Playground since it's already working on a WASM head.

@dr1rrb
Copy link
Member

dr1rrb commented Aug 28, 2020

The last snippet https://playground.platform.uno/#6277af50 points to the visual state triggers. I'm updating the title.

@dr1rrb dr1rrb changed the title RenderTansform animations don't work inside the Playground VisualStateTrigger are not working properly in the Playground Aug 28, 2020
@dr1rrb
Copy link
Member

dr1rrb commented Aug 28, 2020

FYI, for this bug I would suspect a sequencing issue: We are setting the IsActive="True" during the construction while the element still does not have any visual element, so the GoToState does nothing at this point. Then we don't re-evaluate the VisualStateTrigger this when the control gets loaded.

@dr1rrb
Copy link
Member

dr1rrb commented Aug 3, 2023

The original code snippet (https://playground.platform.uno/#edfd17fa) is still not working, so I think that the issue is still present unfortunately :(

@agneszitte
Copy link
Contributor Author

Issue still happening with latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/playground Categorizes an issue or PR as relevant to the Playground kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification.
Projects
None yet
Development

No branches or pull requests

2 participants