2 * Copyright(c) 2021 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.
18 using System.ComponentModel;
19 using System.Collections.Generic;
20 using System.Diagnostics.CodeAnalysis;
22 namespace Tizen.NUI.BaseComponents
25 /// RiveAnimationView renders an animated vector image (Rive file).
27 [EditorBrowsable(EditorBrowsableState.Never)]
28 public class RiveAnimationView : View
30 static RiveAnimationView() { }
33 /// RiveAnimationView constructor.
35 /// <param name="url">The rive resource URL</param>
36 ///[EditorBrowsable(EditorBrowsableState.Never)]
37 public RiveAnimationView(string url) : this(Interop.RiveAnimationView.New(url), true)
39 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
42 internal RiveAnimationView(global::System.IntPtr cPtr, bool shown = true) : base(cPtr, shown)
51 /// Eanables the given animation.
53 /// <param name="animationName">The animation to enable</param>
54 /// <param name="on">The enable state of given animation</param>
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public void EnableAnimation(string animationName, bool on)
58 Interop.RiveAnimationView.EnableAnimation(SwigCPtr, animationName, on);
64 [EditorBrowsable(EditorBrowsableState.Never)]
67 Interop.RiveAnimationView.Play(SwigCPtr);
73 [EditorBrowsable(EditorBrowsableState.Never)]
76 Interop.RiveAnimationView.Pause(SwigCPtr);
82 [EditorBrowsable(EditorBrowsableState.Never)]
85 Interop.RiveAnimationView.Stop(SwigCPtr);
89 /// Sets the fill color of given fill.
91 /// <param name="shapeFillName">The shape fill name</param>
92 /// <param name="color">The rgba color</param>
93 [EditorBrowsable(EditorBrowsableState.Never)]
94 public void SetShapeFillColor(string shapeFillName, Color color)
97 throw new ArgumentNullException(nameof(color));
98 Interop.RiveAnimationView.SetShapeFillColor(SwigCPtr, shapeFillName, color.SwigCPtr);
102 /// Sets the shape stroke color of given stroke.
104 /// <param name="shapeStrokeName">The shape stroke name</param>
105 /// <param name="color">The rgba color</param>
106 [EditorBrowsable(EditorBrowsableState.Never)]
107 public void SetShapeStrokeColor(string shapeStrokeName, Color color)
110 throw new ArgumentNullException(nameof(color));
111 Interop.RiveAnimationView.SetShapeStrokeColor(SwigCPtr, shapeStrokeName, color.SwigCPtr);
115 /// Sets the opacity of given node.
117 /// <param name="nodeName">The node name</param>
118 /// <param name="opacity">The opacity of given node</param>
119 [EditorBrowsable(EditorBrowsableState.Never)]
120 public void SetNodeOpacity(string nodeName, float opacity)
122 Interop.RiveAnimationView.SetNodeOpacity(SwigCPtr, nodeName, opacity);
126 /// Sets the scale of given node.
128 /// <param name="nodeName">The node name</param>
129 /// <param name="scale">The scale of given node</param>
130 [EditorBrowsable(EditorBrowsableState.Never)]
131 public void SetNodeScale(string nodeName, Vector2 scale)
134 throw new ArgumentNullException(nameof(scale));
135 Interop.RiveAnimationView.SetNodeScale(SwigCPtr, nodeName, Vector2.getCPtr(scale));
139 /// Sets the rotation of given node.
141 /// <param name="nodeName">The node name</param>
142 /// <param name="degree">The degree of given node</param>
143 [EditorBrowsable(EditorBrowsableState.Never)]
144 public void SetNodeRotation(string nodeName, Degree degree)
147 throw new ArgumentNullException(nameof(degree));
148 Interop.RiveAnimationView.SetNodeRotation(SwigCPtr, nodeName, Degree.getCPtr(degree));
152 /// Sets the position of given node.
154 /// <param name="nodeName">The node name</param>
155 /// <param name="position">The position of given node</param>
156 [EditorBrowsable(EditorBrowsableState.Never)]
157 public void SetNodePosition(string nodeName, Position position)
159 if (position == null)
160 throw new ArgumentNullException(nameof(position));
161 Interop.RiveAnimationView.SetNodePosition(SwigCPtr, nodeName, position.SwigCPtr);
165 /// Sets the animation elapsed time.
167 /// <param name="animationName">The animation name</param>
168 /// <param name="elapsed">The elapsed time</param>
169 [EditorBrowsable(EditorBrowsableState.Never)]
170 public void SetAnimationElapsedTime(string animationName, float elapsed)
172 Interop.RiveAnimationView.SetAnimationElapsedTime(SwigCPtr, animationName, elapsed);