public override void Init() { if (data != null) { _phonePanel = new PhonePanel(PhonePanelType.Tips); } else { _phonePanel = new PhonePanel(); } //todo 这里做识别是tips 还是手机按钮 _phonePanel.Init(this); _phonePanel.Show(0.5f); GuideManager.RegisterModule(this); if (data != null) { _phonePanel.ShowPhoneCallViewByTips(data); data = null; } }
private async void Switch1_Click(object sender, RoutedEventArgs e) { TokenPanel.Visibility = Visibility.Visible; PhonePanel.Visibility = Visibility.Visible; await PhonePanel.UpdateLayoutAsync(); var logo1 = ElementCompositionPreview.GetElementVisual(Logo1); var logo2 = ElementCompositionPreview.GetElementVisual(Logo2); var token = ElementCompositionPreview.GetElementVisual(Token); var inner1 = ElementCompositionPreview.GetElementVisual(TokenInnerPanel); var inner2 = ElementCompositionPreview.GetElementVisual(PhoneInnerPanel); var transform1 = Logo2Panel.TransformToVisual(Logo1Panel); var point1 = transform1.TransformPoint(new Point()).ToVector2(); var transform2 = Logo1Panel.TransformToVisual(Logo2Panel); var point2 = transform2.TransformPoint(new Point()).ToVector2(); var batch = Window.Current.Compositor.CreateScopedBatch(CompositionBatchTypes.Animation); batch.Completed += (s, args) => { TokenPanel.Visibility = Visibility.Collapsed; PhonePanel.Visibility = Visibility.Visible; }; // Small to big var offset1 = Window.Current.Compositor.CreateVector3KeyFrameAnimation(); offset1.InsertKeyFrame(0, new Vector3()); offset1.InsertKeyFrame(1, new Vector3(point1.X, point1.Y, 0)); var scale1 = Window.Current.Compositor.CreateVector3KeyFrameAnimation(); scale1.InsertKeyFrame(0, new Vector3(1)); scale1.InsertKeyFrame(1, new Vector3(160f / 48f)); var opacity1 = Window.Current.Compositor.CreateScalarKeyFrameAnimation(); opacity1.InsertKeyFrame(0, 1); opacity1.InsertKeyFrame(1, 0); logo1.StartAnimation("Offset", offset1); logo1.StartAnimation("Scale", scale1); logo1.StartAnimation("Opacity", opacity1); // Big to small var offset2 = Window.Current.Compositor.CreateVector3KeyFrameAnimation(); offset2.InsertKeyFrame(0, new Vector3(point2.X, point2.Y, 0)); offset2.InsertKeyFrame(1, new Vector3()); var scale2 = Window.Current.Compositor.CreateVector3KeyFrameAnimation(); scale2.InsertKeyFrame(0, new Vector3(48f / 160f)); scale2.InsertKeyFrame(1, new Vector3(1)); var opacity2 = Window.Current.Compositor.CreateScalarKeyFrameAnimation(); opacity2.InsertKeyFrame(0, 0); opacity2.InsertKeyFrame(1, 1); logo2.StartAnimation("Offset", offset2); logo2.StartAnimation("Scale", scale2); logo2.StartAnimation("Opacity", opacity2); // Other var scale3 = Window.Current.Compositor.CreateVector3KeyFrameAnimation(); scale3.InsertKeyFrame(0, new Vector3(1)); scale3.InsertKeyFrame(1, new Vector3(0)); var opacity3 = Window.Current.Compositor.CreateScalarKeyFrameAnimation(); opacity3.InsertKeyFrame(0, 1); opacity3.InsertKeyFrame(1, 0); token.CenterPoint = new Vector3(120); token.StartAnimation("Opacity", opacity3); token.StartAnimation("Scale", scale3); inner1.StartAnimation("Opacity", opacity1); inner2.StartAnimation("Opacity", opacity2); batch.End(); }