2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 namespace HelloTestExample
23 class Example : NUIApplication
25 private void LOG(string _str)
27 Tizen.Log.Debug("NUI", _str);
28 //Console.WriteLine("[NUI]" + _str);
31 private Animation _animation;
32 private TextLabel _text;
35 public Example() : base()
39 public Example(string stylesheet) : base(stylesheet)
43 public Example(string stylesheet, Application.WindowMode windowMode) : base(stylesheet, windowMode)
47 private void Initialize()
49 LOG("Customized Application Initialize event handler");
50 _stage = Stage.Instance;
51 _stage.Touch += OnStageTouched;
53 // Add a _text label to the stage
54 _text = new TextLabel("Hello NUI World");
55 _text.ParentOrigin = ParentOrigin.Center;
56 _text.AnchorPoint = AnchorPoint.Center;
57 _text.HorizontalAlignment = "CENTER";
58 _text.PointSize = 32.0f;
59 _text.TextColor = Color.Magenta;
60 _stage.GetDefaultLayer().Add(_text);
63 // Callback for _animation finished signal handling
64 public void AnimationFinished(object sender, EventArgs e)
66 LOG("AnimationFinished()!");
69 LOG("Duration= " + _animation.Duration);
70 LOG("EndAction= " + _animation.EndAction);
73 LOG("[4]_text PositionX =" + _text.PositionX + " SizeHeight=" + _text.SizeHeight);
76 // Callback for stage touched signal handling
77 public void OnStageTouched(object sender, Stage.TouchEventArgs e)
79 // Only animate the _text label when touch down happens
80 if (e.Touch.GetState(0) == PointStateType.Down)
82 LOG("Customized Stage Touch event handler");
83 // Create a new _animation
86 //_animation.Stop(Dali.Constants.Animation.EndAction.Stop);
90 _animation = new Animation
95 LOG("[1]_text PositionX =" + _text.PositionX + " SizeHeight=" + _text.SizeHeight);
97 _animation.AnimateTo(_text, "PositionX", _text.PositionX + 200.0f);
98 _animation.AnimateTo(_text, "SizeHeight", _text.SizeHeight + 200.0f);
100 LOG("[2]_text PositionX =" + _text.PositionX + " SizeHeight=" + _text.SizeHeight);
102 _animation.AnimateTo(_text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), Vector3.XAxis), 0, 500);
103 _animation.AnimateTo(_text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), Vector3.XAxis), 500, 1000);
105 //_animation.AnimateBy(_text, "ScaleX", 3.0f, 1000, 1500);
106 //_animation.AnimateBy(_text, "ScaleY", 4.0f, 1250, 2000);
107 _animation.EndAction = Animation.EndActions.Discard;
109 // Connect the signal callback for animaiton finished signal
110 _animation.Finished += AnimationFinished;
113 // Play the _animation
116 LOG("[3]_text PositionX =" + _text.PositionX + " SizeHeight=" + _text.SizeHeight);
121 protected override void OnCreate()
128 static void Main(string[] args)
130 Example example = new Example();