/
KeyFrames.cs
executable file
·156 lines (144 loc) · 6.66 KB
/
KeyFrames.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
* Copyright(c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System.ComponentModel;
namespace Tizen.NUI
{
/// <summary>
/// A set of key frames for a property that can be animated using DALi animation.<br />
/// This allows the generation of key frame objects from individual Property::Values.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class KeyFrames : BaseHandle
{
/// <summary>
/// Creates an initialized KeyFrames handle.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public KeyFrames() : this(Interop.KeyFrames.New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal KeyFrames(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
{
}
/// <summary>
/// Adds a key frame.
/// </summary>
/// <param name="progress">A progress value between 0.0 and 1.0.</param>
/// <param name="value">A value.</param>
/// <since_tizen> 3 </since_tizen>
public void Add(float progress, object value)
{
PropertyValue val = PropertyValue.CreateFromObject(value);
Add(progress, val);
val.Dispose();
}
/// <summary>
/// Adds a key frame.
/// </summary>
/// <param name="progress">A progress value between 0.0 and 1.0.</param>
/// <param name="value">A value</param>
/// <param name="alpha">The alpha function used to blend to the next keyframe.</param>
/// <since_tizen> 3 </since_tizen>
public void Add(float progress, object value, AlphaFunction alpha)
{
PropertyValue val = PropertyValue.CreateFromObject(value);
Add(progress, val, alpha);
val.Dispose();
}
/// <summary>
/// Gets the type of the key frame.<br/>
/// An empty key frame will return PropertyType.None, wheras an initialised<br/>
/// key frame object will return the type of it's first element.
/// </summary>
/// <returns>The key frame property type</returns>
/// <since_tizen> 3 </since_tizen>
public new PropertyType GetType()
{
PropertyType ret = (PropertyType)Interop.KeyFrames.GetType(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Adds a key frame.
/// </summary>
/// <param name="progress">A progress value between 0.0 and 1.0.</param>
/// <param name="value">A value.</param>
/// <since_tizen> 3 </since_tizen>
public void Add(float progress, PropertyValue value)
{
Interop.KeyFrames.Add(SwigCPtr, progress, PropertyValue.getCPtr(value));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Adds a key frame.
/// </summary>
/// <param name="progress">A progress value between 0.0 and 1.0.</param>
/// <param name="value">A value.</param>
/// <param name="alpha">The alpha function used to blend to the next keyframe.</param>
/// <since_tizen> 3 </since_tizen>
public void Add(float progress, PropertyValue value, AlphaFunction alpha)
{
Interop.KeyFrames.Add(SwigCPtr, progress, PropertyValue.getCPtr(value), AlphaFunction.getCPtr(alpha));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Get the number of added key frame.
/// </summary>
/// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public uint GetKeyFrameCount()
{
uint ret = Interop.KeyFrames.GetKeyFrameCount(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Get the progress and value from specific key frame.<br/>
/// If index is greater or equal than total key frame count, progress and value is not changed.
/// </summary>
/// <param name="index">The index of keyframe.</param>
/// <param name="progress">A progress value between 0.0 and 1.0.</param>
/// <param name="value">A value.</param>
/// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void GetKeyFrame(uint index, out float progress, PropertyValue value)
{
Interop.KeyFrames.GetKeyFrame(SwigCPtr, index, out progress, PropertyValue.getCPtr(value));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Set the value to specific key frame.<br/>
/// If index is greater or equal than total key frame count or value's PropertyType is not matched, Nothing happened.
/// </summary>
/// <param name="index">The index of keyframe.</param>
/// <param name="value">A value.</param>
/// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetKeyFrameValue(uint index, PropertyValue value)
{
Interop.KeyFrames.SetKeyFrameValue(SwigCPtr, index, PropertyValue.getCPtr(value));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// This will not be public opened.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
Interop.KeyFrames.DeleteKeyFrames(swigCPtr);
}
}
}