-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Trigger animation from ViewModel #4
Comments
You can create a trigger with a Command BindableProperty, bind the command and init the animation. Similar to https://github.com/jsuarezruiz/AlohaKit.Animations/blob/main/src/AlohaKit.Animations/Triggers/BeginAnimation.cs, but with one command. We can add it to the library. |
Can you help us provide a small example? We still don't understand what you are describing. |
Cab you help us with an example, im also looking for a way to start an animation at the opening of a page without a trigger or a scroll. |
@hiroian Take a look at the example below and give it a try! KakaoTalk_Recording_20240520_233405.mp4 <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:alohakit="clr-namespace:AlohaKit.Animations;assembly=AlohaKit.Animations"
x:Class="PageLoadAnimation.MainPage">
<ContentPage.Resources>
<alohakit:ScaleToAnimation
x:Key="ScaleToAnimation"
Target="{x:Reference ImageBot}"
Duration="10000"
Scale="2.0"/>
</ContentPage.Resources>
<ContentPage.Triggers>
<EventTrigger Event="Loaded">
<alohakit:BeginAnimation
Animation="{StaticResource ScaleToAnimation}" />
</EventTrigger>
</ContentPage.Triggers>
<ScrollView>
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Image
x:Name="ImageBot"
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a race car number eight" />
<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />
<Label
Text="Welcome to .NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Fill"/>
</VerticalStackLayout>
</ScrollView>
</ContentPage> |
Thanks @lukewire129 ! Exactly what i was looking for! |
Is it possible to start the animation from the ViewModel?
The text was updated successfully, but these errors were encountered: