title: Animate labels for 20 seconds
body: <p>I have 3 labels binded like following</p>
  <pre><code>&lt;StackLayout&gt;
  
  &lt;Label Padding=&quot;1&quot; Text=&quot;VRN&quot;  FontSize=&quot;25&quot; TextColor=&quot;Black&quot;  VerticalOptions=&quot;Center&quot; HorizontalTextAlignment=&quot;Center&quot;/&gt; 
                                 
  &lt;Label Padding=&quot;1&quot;  Text=&quot;{Binding VRN}&quot; TextColor=&quot;#ba000d&quot; FontSize=&quot;100&quot; FontAttributes=&quot;Bold&quot; VerticalOptions=&quot;Center&quot; HorizontalTextAlignment=&quot;Center&quot;/&gt;
  
  &lt;Label  Padding=&quot;1&quot; Text=&quot;Make&quot; FontSize=&quot;25&quot; TextColor=&quot;Black&quot;  VerticalOptions=&quot;Center&quot; HorizontalTextAlignment=&quot;Center&quot;/&gt;
                                  
   &lt;Label Text=&quot;{Binding Make}&quot; TextColor=&quot;#ba000d&quot; FontSize=&quot;100&quot; FontAttributes=&quot;Bold&quot; VerticalOptions=&quot;Center&quot; HorizontalTextAlignment=&quot;Center&quot;/&gt;
                                                                
    &lt;Label Text=&quot;{Binding Model}&quot; TextColor=&quot;#ba000d&quot; FontSize=&quot;30&quot; FontAttributes=&quot;Bold&quot; VerticalOptions=&quot;Center&quot; HorizontalTextAlignment=&quot;Center&quot;/&gt;
  
  &lt;/StackLayout&gt;
  </code></pre>
  <p>Binding is done in ItemModel like following</p>
  <pre><code>string _vrn = &quot;&quot;;
          public string VRN
          {
              protected set
              {
                  if (_vrn != value)
                  {
                      _vrn = value;
                      OnPropertyChanged(&quot;VRN&quot;);
                  }
              }
              get { return _vrn ; }
          }
          string _make= &quot;&quot;;
          public string Make
          {
              protected set
              {
                  if (_make!= value)
                  {
                      _make= value;
                      OnPropertyChanged(&quot;Make&quot;);
                  }
              }
              get { return _make; }
          }
          string _model = &quot;&quot;;
          public string Model
          {
              protected set
              {
                  if (_model != value)
                  {
                      _model = value;
                      OnPropertyChanged(&quot;Model&quot;);
                  }
              }
              get { return _model ; }
          }
             hubConnection.On&lt;string&gt;(&quot;NewItem&quot;, (item) =&gt;
              {
                  MainThread.BeginInvokeOnMainThread(async () =&gt;
                  {
           
                          Item newItem = JsonConvert.DeserializeObject&lt;Item&gt;(item);    
                          VRN= newItem.VRN;
                          Make= newItem.Make;
                          Model= newItem.Model;
                   }
                 }
  </code></pre>
  <p>Above code will set the labels with value of last item inserted. Up to here done.</p>
  <p>I want to animate(Blink) the 3 labels for 20 seconds whenever new item is added to Item ObservableCollection(I am using SignalR to insert data)</p>
  <p>I already have a class which i am using it with CollectionView for another scenario.Is there any way i can use the following class to animate Labels or is there any other easy way?</p>
  <pre><code>public class BlinkTriggerAction : TriggerAction&lt;VisualElement&gt;
  {
      protected async override void Invoke(VisualElement sender)
      {
              var parentAnimation = new Animation();
              var fadeOutAnimation = new Animation(d =&gt; sender.Opacity = d, 1, 0, Easing.Linear);
              var fadeInAnimation = new Animation(d =&gt; sender.Opacity = d, 0, 1, Easing.Linear);
              parentAnimation.Add(0, 0.5, fadeOutAnimation);
              parentAnimation.Add(0.5, 1, fadeInAnimation);
              parentAnimation.Add(0, 0.5, fadeOutAnimation);
              parentAnimation.Add(0.5, 1, fadeInAnimation);
              parentAnimation.Add(0, 0.5, fadeOutAnimation);
              parentAnimation.Add(0.5, 1, fadeInAnimation);
              parentAnimation.Add(0, 0.5, fadeOutAnimation);
              parentAnimation.Add(0.5, 1, fadeInAnimation);
              parentAnimation.Commit(sender, &quot;BlinkingVisualElement&quot;, 16, 800, repeat: () =&gt; true);
              await Task.Delay(20000);
              parentAnimation.Add(0, 0.5, fadeOutAnimation);
              parentAnimation.Add(0.5, 1, fadeInAnimation);
              sender.AbortAnimation(&quot;BlinkingVisualElement&quot;);
  
      }
  }
  </code></pre>