[NUI] sync with https://github.com/nui-dali/NUITizenGallery
[platform/core/csapi/tizenfx.git] / test / NUITizenGallery / Examples / AnimationTest / AnimationTest3Page.xaml.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System;
18 using Tizen.NUI;
19 using Tizen.NUI.BaseComponents;
20 using Tizen.NUI.Components;
21
22 namespace NUITizenGallery
23 {
24     public partial class AnimationTest3Page : ContentPage
25     {
26         private Animation animation;
27
28         public AnimationTest3Page()
29         {
30             InitializeComponent();
31
32             animation = new Animation(2000);
33             animation.AnimateTo(imageView, "Opacity", 0.0f, 0, 1000);
34             animation.AnimateTo(imageView, "Opacity", 1.0f, 1000, 2000);
35             animation.AnimateTo(imageView, "PositionY", 400.0f, 0, 2000);
36             animation.AnimateTo(imageView, "ScaleX", 2.0f, 0, 1000);
37             animation.AnimateTo(imageView, "ScaleY", 2.0f, 0, 1000);
38             animation.AnimateTo(imageView, "ScaleX", 1.0f, 1000, 2000);
39             animation.AnimateTo(imageView, "ScaleY", 1.0f, 1000, 2000);
40             animation.AnimateTo(imageView, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.Z), 0, 1000);
41             animation.AnimateTo(imageView, "Orientation", new Rotation(new Radian(new Degree(360.0f)), PositionAxis.Z), 1000, 2000);
42             image1Btn.Clicked += (o, e) =>
43             {
44                 imageView.PositionY = 0.0f;
45                 imageView.Orientation = new Rotation(new Radian(new Degree(0.0f)), PositionAxis.Z);
46                 animation.Play();
47                 desc1.Text = "True";
48             };
49
50             image2Btn.Clicked += (o, e) =>
51             {
52                 animation.Stop();
53                 desc1.Text = "False";
54             };
55         }
56     }
57 }