private void TxtPath() { var path = ChartTool.GetStringPath("Object To evaluate.x"); CAShapeLayer layer = new CAShapeLayer(); layer.Frame = new CGRect(new CGPoint(20, 20), path.CGPath.PathBoundingBox.Size); layer.Path = path.CGPath; layer.StrokeColor = UIColor.Red.CGColor; layer.FillColor = UIColor.Clear.CGColor; //layer.BackgroundColor = UIColor.White.CGColor; layer.GeometryFlipped = true; layer.LineWidth = 2; Context.Layer.AddSublayer(layer); CABasicAnimation animation = CABasicAnimation.FromKeyPath("strokeEnd"); animation.From = NSNumber.FromNInt(0); animation.To = NSNumber.FromInt16(1); animation.RemovedOnCompletion = false; animation.FillMode = CAFillMode.Forwards; animation.Duration = 4; layer.AddAnimation(animation, "ma"); }
private void PlaceFeature(string message, CGPoint p, float offset) { // Create and configure a node with a text geometry, and add it to the scene var text = SCNText.Create(message, 5); text.Font = Font; text.Flatness = 0.4f; text.Materials = Materials; var textNode = SCNNode.Create(); textNode.Geometry = text; textNode.Position = new SCNVector3(p.X, p.Y + Altitude, 0); textNode.Scale = new SCNVector3(0.02f, 0.02f, 0.02f); ContentNode.AddChildNode(textNode); // Animation the node's position and opacity var positionAnimation = CABasicAnimation.FromKeyPath("position.z"); positionAnimation.From = NSNumber.FromInt16(-10); positionAnimation.To = NSNumber.FromInt16(14); positionAnimation.Duration = 7.0f; positionAnimation.TimeOffset = -offset * positionAnimation.Duration; positionAnimation.RepeatCount = float.MaxValue; textNode.AddAnimation(positionAnimation, new NSString("positionAnimation")); var opacityAnimation = CAKeyFrameAnimation.FromKeyPath("opacity"); opacityAnimation.KeyTimes = new NSNumber[] { 0.0f, 0.2f, 0.9f, 1.0f }; opacityAnimation.Values = new NSNumber[] { 0.0f, 1.0f, 1.0f, 0.0f }; opacityAnimation.Duration = positionAnimation.Duration; opacityAnimation.TimeOffset = positionAnimation.TimeOffset; opacityAnimation.RepeatCount = float.MaxValue; textNode.AddAnimation(opacityAnimation, new NSString("opacityAnimation")); }
public static NSObject ConvertToNSObject(object obj) { if (obj != null) { if (obj is Boolean) { return(NSNumber.FromBoolean((bool)obj)); } else if (obj is Byte) { return(NSNumber.FromByte((byte)obj)); } else if (obj is SByte) { return(NSNumber.FromSByte((sbyte)obj)); } else if (obj is Int16) { return(NSNumber.FromInt16((short)obj)); } else if (obj is Int32) { return(NSNumber.FromInt32((int)obj)); } else if (obj is Int64) { return(NSNumber.FromInt64((long)obj)); } else if (obj is UInt16) { return(NSNumber.FromUInt16((ushort)obj)); } else if (obj is UInt32) { return(NSNumber.FromUInt32((uint)obj)); } else if (obj is UInt64) { return(NSNumber.FromUInt64((ulong)obj)); } else if (obj is Single) { return(NSNumber.FromFloat((float)obj)); } else if (obj is Double) { return(NSNumber.FromDouble((double)obj)); } else if (obj is string) { return(new NSString(obj.ToString())); } else if (obj is Guid) { return(new NSUuid(((Guid)obj).ToByteArray())); } else if (obj is DateTime) { return(((DateTime)obj).ToNSDate()); } else if (obj is DateTimeOffset) { return(new NSString(((DateTimeOffset)obj).ToString("O"))); } } return(null); }