Skip to content

Commit

Permalink
dont animate item opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
huynhsontung committed Dec 23, 2021
1 parent f7f2432 commit 49469a7
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions Indirect/Controls/ThreadItemControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using NeoSmart.Unicode;
using System.Numerics;
using Windows.UI.Xaml.Hosting;
using Windows.UI.Composition;

// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236

Expand Down Expand Up @@ -74,22 +73,12 @@ private void MainContentControl_SizeChanged(object sender, SizeChangedEventArgs
var prev = e.PreviousSize.ToVector2();
var next = e.NewSize.ToVector2();

var batch = Window.Current.Compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
var anim = Window.Current.Compositor.CreateVector3KeyFrameAnimation();
anim.InsertKeyFrame(0, new Vector3(prev / next, 1));
anim.InsertKeyFrame(1, Vector3.One);

var content = ((ContentControl)sender).ContentTemplateRoot;
var panel = ElementCompositionPreview.GetElementVisual(content);

if (!Item.IsInitialized)
{
var scalarAnim = Window.Current.Compositor.CreateScalarKeyFrameAnimation();
scalarAnim.InsertKeyFrame(0, 0);
scalarAnim.InsertKeyFrame(1, 1);
panel.StartAnimation("Opacity", scalarAnim);
}

panel.CenterPoint = new Vector3(Item.FromMe ? next.X : 0, 0, 0);
panel.StartAnimation("Scale", anim);

Expand All @@ -102,8 +91,6 @@ private void MainContentControl_SizeChanged(object sender, SizeChangedEventArgs
var text = ElementCompositionPreview.GetElementVisual(content.FindDescendant<TextBlock>());
text.StartAnimation("Scale", factor);
}

batch.End();
}

public void OnItemClick()
Expand Down

0 comments on commit 49469a7

Please sign in to comment.