public void PathAddControlPoint() { tlog.Debug(tag, $"PathAddControlPoint START"); var testingTarget = new Path(); Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <Path>(testingTarget, "should be an instance of Path class!"); using (Position position = new Position(0.5f, 0.0f, 0.8f)) { testingTarget.AddControlPoint(position); Vector3 vector = new Vector3(0, 0, 0); var result = testingTarget.ControlPoints[0].Get(vector); Assert.IsTrue(result); vector.Dispose(); } testingTarget.Dispose(); tlog.Debug(tag, $"PathAddControlPoint END (OK)"); }
//[Property("AUTHOR", "Feng Jin, [email protected]")] public void AnimatePath_1() { Tizen.Log.Debug("NUI", "#### 1) animate path test !"); /* TEST CODE */ View view = new View(); view.ParentOrigin = ParentOrigin.TopLeft; view.PivotPoint = PivotPoint.TopLeft; view.MinimumSize = new Size2D(100, 100); view.BackgroundColor = Color.Red; _window.Add(view); Position position0 = new Position(200.0f, 200.0f, 0.0f); Position position1 = new Position(300.0f, 300.0f, 0.0f); Position position2 = new Position(400.0f, 400.0f, 0.0f); Path path = new Path(); path.AddPoint(position0); path.AddPoint(position1); path.AddPoint(position2); //Control points for first segment path.AddControlPoint(new Vector3(39.0f, 90.0f, 0.0f)); path.AddControlPoint(new Vector3(56.0f, 119.0f, 0.0f)); //Control points for second segment path.AddControlPoint(new Vector3(78.0f, 120.0f, 0.0f)); path.AddControlPoint(new Vector3(93.0f, 104.0f, 0.0f)); Animation animation = new Animation(); animation.AnimatePath(view, path, Vector3.XAxis, 0, 5000, new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear)); animation.Play(); Vector3 position = new Vector3(); Vector3 tangent = new Vector3(); path.Sample(0.0f, position, tangent); Rotation rotation = new Rotation(new Radian(new Degree(0.0f)), tangent); Tizen.Log.Debug("NUI", "################ progress = 0! "); Tizen.Log.Debug("NUI", "position=(" + position.X + "," + position.Y + "," + position.Z + ")"); Tizen.Log.Debug("NUI", "view position=(" + view.Position.X + "," + view.Position.Y + "," + view.Position.Z + ")"); Tizen.Log.Debug("NUI", "view position=(" + view.PositionX + "," + view.PositionY + "," + view.PositionZ + ")"); Tizen.Log.Debug("NUI", "view cur position=(" + view.CurrentPosition.X + "," + view.CurrentPosition.Y + "," + view.CurrentPosition.Z + ")"); Tizen.Log.Debug("NUI", "tangent=(" + tangent.X + "," + tangent.Y + "," + tangent.Z + ")"); Tizen.Log.Debug("NUI", "angle between=" + Rotation.AngleBetween(view.Orientation, rotation) + " view orientation length=" + view.Orientation.Length() + " rotation length=" + rotation.Length()); //Assert.AreEqual(position.X, view.PositionX, "The actor's PositionX of is not correct"); //Assert.AreEqual(position.Y, actor.PositionY, "The actor's PositionY of is not correct"); //Assert.AreEqual(position.Z, actor.PositionZ, "The actor's PositionZ of is not correct"); //Assert.IsTrue(rotation.Equals(actor.Orientation)); //await Task.Delay(250); path.Sample(0.25f, position, tangent); rotation = new Rotation(new Radian(new Degree(0.0f)), tangent); Tizen.Log.Debug("NUI", "################ progress = 0.25! "); Tizen.Log.Debug("NUI", "position=(" + position.X + "," + position.Y + "," + position.Z + ")"); Tizen.Log.Debug("NUI", "view position=(" + view.Position.X + "," + view.Position.Y + "," + view.Position.Z + ")"); Tizen.Log.Debug("NUI", "view position=(" + view.PositionX + "," + view.PositionY + "," + view.PositionZ + ")"); Tizen.Log.Debug("NUI", "view cur position=(" + view.CurrentPosition.X + "," + view.CurrentPosition.Y + "," + view.CurrentPosition.Z + ")"); Tizen.Log.Debug("NUI", "tangent=(" + tangent.X + "," + tangent.Y + "," + tangent.Z + ")"); Tizen.Log.Debug("NUI", "angle between=" + Rotation.AngleBetween(view.Orientation, rotation) + " view orientation length=" + view.Orientation.Length() + " rotation length=" + rotation.Length()); //Assert.AreEqual(position.X, actor.PositionX, "The PositionX of actor is not correct"); //Assert.AreEqual(position.Y, actor.PositionY, "The PositionY of actor is not correct"); //Assert.AreEqual(position.Z, actor.PositionZ, "The PositionZ of actor is not correct"); //Assert.IsTrue(rotation.Equals(actor.Orientation)); //await Task.Delay(500); path.Sample(0.75f, position, tangent); rotation = new Rotation(new Radian(new Degree(0.0f)), tangent); Tizen.Log.Debug("NUI", "################ progress = 0.75! "); Tizen.Log.Debug("NUI", "position=(" + position.X + "," + position.Y + "," + position.Z + ")"); Tizen.Log.Debug("NUI", "view position=(" + view.Position.X + "," + view.Position.Y + "," + view.Position.Z + ")"); Tizen.Log.Debug("NUI", "view position=(" + view.PositionX + "," + view.PositionY + "," + view.PositionZ + ")"); Tizen.Log.Debug("NUI", "view cur position=(" + view.CurrentPosition.X + "," + view.CurrentPosition.Y + "," + view.CurrentPosition.Z + ")"); Tizen.Log.Debug("NUI", "tangent=(" + tangent.X + "," + tangent.Y + "," + tangent.Z + ")"); Tizen.Log.Debug("NUI", "angle between=" + Rotation.AngleBetween(view.Orientation, rotation) + " view orientation length=" + view.Orientation.Length() + " rotation length=" + rotation.Length()); //Assert.AreEqual(position.X, actor.PositionX, "The PositionX of actor is not correct here"); //Assert.AreEqual(position.Y, actor.PositionY, "The PositionY of actor is not correct here"); //Assert.AreEqual(position.Z, actor.PositionZ, "The PositionZ of actor is not correct here"); //Assert.IsTrue(rotation.Equals(actor.Orientation)); path.Sample(1.0f, position, tangent); rotation = new Rotation(new Radian(new Degree(0.0f)), tangent); Tizen.Log.Debug("NUI", "################ progress = 1.0! "); Tizen.Log.Debug("NUI", "position=(" + position.X + "," + position.Y + "," + position.Z + ")"); Tizen.Log.Debug("NUI", "view position=(" + view.Position.X + "," + view.Position.Y + "," + view.Position.Z + ")"); Tizen.Log.Debug("NUI", "view position=(" + view.PositionX + "," + view.PositionY + "," + view.PositionZ + ")"); Tizen.Log.Debug("NUI", "view cur position=(" + view.CurrentPosition.X + "," + view.CurrentPosition.Y + "," + view.CurrentPosition.Z + ")"); Tizen.Log.Debug("NUI", "tangent=(" + tangent.X + "," + tangent.Y + "," + tangent.Z + ")"); Tizen.Log.Debug("NUI", "angle between=" + Rotation.AngleBetween(view.Orientation, rotation) + " view orientation length=" + view.Orientation.Length() + " rotation length=" + rotation.Length()); Tizen.Log.Debug("NUI", "#### 2) animate path test end!"); }