// Highlight the node at index 'index' by setting a CI filter private void HighlightContact(int index, PresentationViewController presentationViewController) { // Create a filter var glowFilter = new SCGlowFilter(); glowFilter.Name = "aGlow"; glowFilter.SetDefaults(); // Retrieve the node to highlight // Scale up and move to front a little var contactNode = GroupNode.FindChildNode("contact" + index, true); contactNode.Scale = new SCNVector3(1.2f, 1.2f, 1.2f); contactNode.Position = new SCNVector3(contactNode.Position.X, contactNode.Position.Y, contactNode.Position.Z + 50); // Compute the screenspace position of this node because the glow filter needs this info var worldPosition = contactNode.ConvertPositionToNode(new SCNVector3(0, 0, 0), null); var screenPosition = ((SCNView)presentationViewController.View).ProjectPoint(worldPosition); var screenPositionInPixels = ((SCNView)presentationViewController.View).ConvertPointToBacking(new CGPoint(screenPosition.X, screenPosition.Y)); glowFilter.CenterX = screenPositionInPixels.X; glowFilter.CenterY = screenPositionInPixels.Y; glowFilter.InputRadius = new NSNumber(10); // Set the filter // TODO contactNode.Filters = new CIFilter[] { glowFilter }; // Animate the radius parameter of the glow filter /* TODO CABasicAnimation animation = CABasicAnimation.FromKeyPath ("filters.aGlow.inputRadius"); * animation.To = new NSNumber (20); * animation.From = new NSNumber (10); * animation.AutoReverses = true; * animation.RepeatCount = float.MaxValue; * animation.Duration = 1.0f; * animation.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseInEaseOut); * contactNode.AddAnimation (animation, new NSString ("filterAnimation"));*/ }
// Highlight the node at index 'index' by setting a CI filter private void HighlightContact (int index, PresentationViewController presentationViewController) { // Create a filter var glowFilter = new SCGlowFilter (); glowFilter.Name = "aGlow"; glowFilter.SetDefaults (); // Retrieve the node to highlight // Scale up and move to front a little var contactNode = GroupNode.FindChildNode ("contact" + index, true); contactNode.Scale = new SCNVector3 (1.2f, 1.2f, 1.2f); contactNode.Position = new SCNVector3 (contactNode.Position.X, contactNode.Position.Y, contactNode.Position.Z + 50); // Compute the screenspace position of this node because the glow filter needs this info var worldPosition = contactNode.ConvertPositionToNode (new SCNVector3 (0, 0, 0), null); var screenPosition = ((SCNView)presentationViewController.View).ProjectPoint (worldPosition); var screenPositionInPixels = ((SCNView)presentationViewController.View).ConvertPointToBacking (new CGPoint (screenPosition.X, screenPosition.Y)); glowFilter.CenterX = screenPositionInPixels.X; glowFilter.CenterY = screenPositionInPixels.Y; glowFilter.InputRadius = new NSNumber (10); // Set the filter // TODO contactNode.Filters = new CIFilter[] { glowFilter }; // Animate the radius parameter of the glow filter /* TODO CABasicAnimation animation = CABasicAnimation.FromKeyPath ("filters.aGlow.inputRadius"); animation.To = new NSNumber (20); animation.From = new NSNumber (10); animation.AutoReverses = true; animation.RepeatCount = float.MaxValue; animation.Duration = 1.0f; animation.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseInEaseOut); contactNode.AddAnimation (animation, new NSString ("filterAnimation"));*/ }