3 using Tizen.NUI.BaseComponents;
5 namespace Tizen.NUI.Samples
7 public class AnimatedVectorImageViewTest : IExample
10 AnimatedVectorImageView avi, avi2, avi3, avi4, avi5, avi6;
11 public void Activate()
13 Tizen.Log.Fatal("NUITEST", $"###Activate()");
14 win = Window.Instance;
15 win.BackgroundColor = Color.Green;
16 win.KeyEvent += Win_KeyEvent;
18 avi = new AnimatedVectorImageView();
19 avi.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
21 avi.BackgroundColor = Color.White;
22 avi.Position2D = new Position2D(50, 10);
23 avi.Size2D = new Size2D(500, 500);
24 Window.Instance.GetDefaultLayer().Add(avi);
27 avi2 = new AnimatedVectorImageView();
28 avi2.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
29 avi2.RepeatCount = -1;
30 avi2.BackgroundColor = Color.White;
31 avi2.Position2D = new Position2D(600, 10);
32 avi2.Size2D = new Size2D(500, 500);
33 avi2.SetMinMaxFrameByMarker("first");
34 Window.Instance.GetDefaultLayer().Add(avi2);
37 avi3 = new AnimatedVectorImageView();
38 avi3.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
39 avi3.RepeatCount = -1;
40 avi3.BackgroundColor = Color.White;
41 avi3.Position2D = new Position2D(1150, 10);
42 avi3.Size2D = new Size2D(500, 500);
43 avi3.SetMinMaxFrameByMarker("second", "third");
44 Window.Instance.GetDefaultLayer().Add(avi3);
47 avi4 = new AnimatedVectorImageView();
48 avi4.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
49 avi4.RepeatCount = -1;
50 avi4.BackgroundColor = Color.White;
51 avi4.Position2D = new Position2D(50, 550);
52 avi4.Size2D = new Size2D(500, 500);
53 avi4.SetMinMaxFrameByMarker("second");
54 Window.Instance.GetDefaultLayer().Add(avi4);
57 avi5 = new AnimatedVectorImageView();
58 avi5.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
59 avi5.RepeatCount = -1;
60 avi5.BackgroundColor = Color.White;
61 avi5.Position2D = new Position2D(600, 550);
62 avi5.Size2D = new Size2D(500, 500);
63 avi5.SetMinMaxFrameByMarker("third");
64 Window.Instance.GetDefaultLayer().Add(avi5);
67 avi6 = new AnimatedVectorImageView();
68 avi6.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
69 avi6.RepeatCount = -1;
70 avi6.BackgroundColor = Color.White;
71 avi6.Position2D = new Position2D(1150, 550);
72 avi6.Size2D = new Size2D(500, 500);
73 avi6.SetMinMaxFrameByMarker("third", "first");
74 Window.Instance.GetDefaultLayer().Add(avi6);
78 public void Deactivate()
80 win.KeyEvent -= Win_KeyEvent;
82 Window.Instance.GetDefaultLayer().Remove(avi);
83 Window.Instance.GetDefaultLayer().Remove(avi2);
84 Window.Instance.GetDefaultLayer().Remove(avi3);
85 Window.Instance.GetDefaultLayer().Remove(avi4);
86 Window.Instance.GetDefaultLayer().Remove(avi5);
87 Window.Instance.GetDefaultLayer().Remove(avi6);
90 private void Win_KeyEvent(object sender, Window.KeyEventArgs e)
92 if (e.Key.State == Key.StateType.Down)
94 if (e.Key.KeyPressedName == "1")
96 var l = avi.GetContentInfo();
97 foreach (var iter in l)
99 Tizen.Log.Fatal("NUITEST", $"content [{iter.Item1}, {iter.Item2}, {iter.Item3}]");
102 else if (e.Key.KeyPressedName == "2")
104 avi2.SetMinAndMaxFrame(0, 1000);
106 else if (e.Key.KeyPressedName == "3")
108 avi3.SetMinMaxFrameByMarker("first", "second");
110 else if (e.Key.KeyPressedName == "4")
112 avi6.SetMinMaxFrameByMarker("second", "third");
114 else if (e.Key.KeyPressedName == "5")
116 avi6.SetMinMaxFrameByMarker("first", "second");
118 else if (e.Key.KeyPressedName == "6")
120 avi6.SetMinMaxFrame(0, 1000);
122 else if (e.Key.KeyPressedName == "7")
124 avi.Stop(AnimatedVectorImageView.EndActions.Discard);
125 avi2.Stop(AnimatedVectorImageView.EndActions.Discard);
126 avi3.Stop(AnimatedVectorImageView.EndActions.Discard);
127 avi4.Stop(AnimatedVectorImageView.EndActions.Discard);
128 avi5.Stop(AnimatedVectorImageView.EndActions.Discard);
129 avi6.Stop(AnimatedVectorImageView.EndActions.Discard);
131 else if (e.Key.KeyPressedName == "8")
133 avi.Stop(AnimatedVectorImageView.EndActions.StopFinal);
134 avi2.Stop(AnimatedVectorImageView.EndActions.StopFinal);
135 avi3.Stop(AnimatedVectorImageView.EndActions.StopFinal);
136 avi4.Stop(AnimatedVectorImageView.EndActions.StopFinal);
137 avi5.Stop(AnimatedVectorImageView.EndActions.StopFinal);
138 avi6.Stop(AnimatedVectorImageView.EndActions.StopFinal);
140 else if (e.Key.KeyPressedName == "9")
149 else if (e.Key.KeyPressedName == "0")
151 Tizen.Log.Fatal("NUITEST", $"get MinMaxFrame() !");
152 var temp = avi.GetMinMaxFrame();
153 Tizen.Log.Fatal("NUITEST", $"avi min={temp.Item1}, max={temp.Item2}");
154 temp = avi2.GetMinMaxFrame();
155 Tizen.Log.Fatal("NUITEST", $"avi2 min={temp.Item1}, max={temp.Item2}");
156 temp = avi3.GetMinMaxFrame();
157 Tizen.Log.Fatal("NUITEST", $"avi3 min={temp.Item1}, max={temp.Item2}");
158 temp = avi4.GetMinMaxFrame();
159 Tizen.Log.Fatal("NUITEST", $"avi4 min={temp.Item1}, max={temp.Item2}");
160 temp = avi5.GetMinMaxFrame();
161 Tizen.Log.Fatal("NUITEST", $"avi5 min={temp.Item1}, max={temp.Item2}");
162 temp = avi6.GetMinMaxFrame();
163 Tizen.Log.Fatal("NUITEST", $"avi6 min={temp.Item1}, max={temp.Item2}");