Skip to content

Commit

Permalink
Improve animation on virtual tables view.
Browse files Browse the repository at this point in the history
  • Loading branch information
angelinn committed Dec 9, 2024
1 parent a3b576f commit dbb7cfa
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/TramlineFive/TramlineFive.Maui/Pages/VirtualTablesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace TramlineFive.Pages
{
public partial class VirtualTablesPage : Grid
{
private bool isLoaded = false;

public VirtualTablesPage()
{
InitializeComponent();
Expand All @@ -27,7 +29,11 @@ public VirtualTablesPage()

private void OnLoaded(object sender, EventArgs e)
{
Task _ = AnimateText();
if (!isLoaded)
{
isLoaded = true;
Task _ = AnimateText();
}
}

private async Task AnimateText()
Expand All @@ -36,12 +42,24 @@ private async Task AnimateText()
{
if (txtStopName.Width > 0)
{
await txtStopName.TranslateTo(-txtStopName.Width, 0, 5000);
SizeRequest size = txtStopName.Measure(Width, Height);

System.Diagnostics.Debug.WriteLine("TRANSLATING OUT OF VIEW");
await txtStopName.TranslateTo(-size.Request.Width, 0, 3000);

System.Diagnostics.Debug.WriteLine("WAITING OUT OF VIEW");
await Task.Delay(1000);

if (txtStopName.TranslationX == 0)
continue;

txtStopName.TranslationX = Width;

System.Diagnostics.Debug.WriteLine("TRANSLATING IN VIEW");
await txtStopName.TranslateTo(0, 0, 5000);
}

System.Diagnostics.Debug.WriteLine("WAITING IN VIEW");
await Task.Delay(5000);
}
}
Expand Down

0 comments on commit dbb7cfa

Please sign in to comment.