summaryrefslogtreecommitdiff
path: root/ElmSharp/ElmSharp/TransitEffect.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ElmSharp/ElmSharp/TransitEffect.cs')
-rwxr-xr-xElmSharp/ElmSharp/TransitEffect.cs461
1 files changed, 461 insertions, 0 deletions
diff --git a/ElmSharp/ElmSharp/TransitEffect.cs b/ElmSharp/ElmSharp/TransitEffect.cs
new file mode 100755
index 0000000..fd29499
--- /dev/null
+++ b/ElmSharp/ElmSharp/TransitEffect.cs
@@ -0,0 +1,461 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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;
+using System.Collections.Generic;
+
+namespace ElmSharp
+{
+ /// <summary>
+ /// The axis along which flip effect should be applied.
+ /// </summary>
+ public enum FlipAxis
+ {
+ /// <summary>
+ /// Flip on X axis
+ /// </summary>
+ X,
+
+ /// <summary>
+ /// Flip on Y axis
+ /// </summary>
+ Y,
+ }
+
+ /// <summary>
+ /// The direction in which the wipe effect should occur.
+ /// </summary>
+ public enum WipeDirection
+ {
+ /// <summary>
+ /// Wipe to the left
+ /// </summary>
+ Left,
+
+ /// <summary>
+ /// Wipe to the right
+ /// </summary>
+ Right,
+
+ /// <summary>
+ /// Wipe to the up
+ /// </summary>
+ Up,
+
+ /// <summary>
+ /// Wipe to the down
+ /// </summary>
+ Down,
+ }
+
+ /// <summary>
+ /// Whether the wipe effect should show or hide the object.
+ /// </summary>
+ public enum WipeType
+ {
+ /// <summary>
+ /// Hide the object during the animation
+ /// </summary>
+ Hide,
+
+ /// <summary>
+ /// Show the object during the animation
+ /// </summary>
+ Show,
+ }
+
+ /// <summary>
+ /// The type of acceleration used in the transition.
+ /// </summary>
+ public enum TweenMode
+ {
+ /// <summary>
+ /// Constant speed
+ /// </summary>
+ Linear,
+
+ /// <summary>
+ /// Starts slow, increase speed over time, then decrease again and stop slowly, v1 being a power factor
+ /// </summary>
+ Sinusoidal,
+
+ /// <summary>
+ /// Starts fast and decrease speed over time, v1 being a power factor
+ /// </summary>
+ Decelerate,
+
+ /// <summary>
+ /// Starts slow and increase speed over time, v1 being a power factor
+ /// </summary>
+ Accelerate,
+
+ /// <summary>
+ /// Start at gradient v1, interpolated via power of v2 curve
+ /// </summary>
+ DivisorInterpolate,
+
+ /// <summary>
+ /// Start at 0.0 then "drop" like a ball bouncing to the ground at 1.0, and bounce v2 times, with decay factor of v1
+ /// </summary>
+ Bounce,
+
+ /// <summary>
+ /// Start at 0.0 then "wobble" like a spring rest position 1.0, and wobble v2 times, with decay factor of v1
+ /// </summary>
+ Spring,
+
+ /// <summary>
+ /// Follow the cubic-bezier curve calculated with the control points (x1, y1), (x2, y2)
+ /// </summary>
+ BezierCurve,
+ }
+
+ /// <summary>
+ /// Blend effect class.
+ /// </summary>
+ public class BlendEffect : EffectBase
+ {
+ /// <summary>
+ /// Creates and initializes a new instance of BlendEffect class.
+ /// </summary>
+ public BlendEffect()
+ {
+ }
+
+ internal override IntPtr CreateEffect(IntPtr transit)
+ {
+ return Interop.Elementary.elm_transit_effect_blend_add(transit);
+ }
+ }
+
+ /// <summary>
+ /// Color effect class.
+ /// </summary>
+ public class ColorEffect : EffectBase
+ {
+ Color _begin;
+ Color _end;
+
+ /// <summary>
+ /// Creates and initializes a new instance of ColorEffect class.
+ /// </summary>
+ /// <param name="beginColor">The begin color of the effect</param>
+ /// <param name="endColor">The end color of the effect</param>
+ public ColorEffect(Color beginColor, Color endColor)
+ {
+ _begin = beginColor;
+ _end = endColor;
+ }
+
+ /// <summary>
+ /// The begin color of the effect
+ /// </summary>
+ public Color BeginColor
+ {
+ get { return _begin; }
+ }
+
+ /// <summary>
+ /// The end color of the effect
+ /// </summary>
+ public Color EndColor
+ {
+ get { return _end; }
+ }
+
+ internal override IntPtr CreateEffect(IntPtr transit)
+ {
+ return Interop.Elementary.elm_transit_effect_color_add(transit, _begin.R, _begin.G, _begin.B, _begin.A, _end.R, _end.G, _end.B, _end.A);
+ }
+ }
+
+ /// <summary>
+ /// Fade effect class.
+ /// </summary>
+ public class FadeEffect : EffectBase
+ {
+ /// <summary>
+ /// Creates and initializes a new instance of FadeEffect class.
+ /// </summary>
+ public FadeEffect()
+ {
+ }
+
+ internal override IntPtr CreateEffect(IntPtr transit)
+ {
+ return Interop.Elementary.elm_transit_effect_fade_add(transit);
+ }
+ }
+
+ /// <summary>
+ /// Flip effect class.
+ /// </summary>
+ public class FlipEffect : EffectBase
+ {
+ FlipAxis _axis;
+ bool _clockWise;
+ bool _resizable;
+
+ /// <summary>
+ /// Creates and initializes a new instance of FlipEffect class.
+ /// </summary>
+ /// <param name="axis">Flipping Axis(X or Y).</param>
+ /// <param name="clockWise">Flipping Direction. True is clock-wise.</param>
+ /// <param name="resizable">Resizable effect with FlipEffect</param>
+ public FlipEffect(FlipAxis axis, bool clockWise, bool resizable = false)
+ {
+ _axis = axis;
+ _clockWise = clockWise;
+ _resizable = resizable;
+ }
+
+ /// <summary>
+ /// Flipping Axis(X or Y).
+ /// </summary>
+ public FlipAxis Axis
+ {
+ get { return _axis; }
+ }
+
+ /// <summary>
+ /// Flipping Direction. True is clock-wise.
+ /// </summary>
+ public bool ClockWise
+ {
+ get { return _clockWise; }
+ }
+
+ /// <summary>
+ /// Resizable FlipEffect.
+ /// </summary>
+ public bool Resizable
+ {
+ get { return _resizable; }
+ }
+
+ internal override IntPtr CreateEffect(IntPtr transit)
+ {
+ if (_resizable)
+ return Interop.Elementary.elm_transit_effect_resizable_flip_add(transit, (int)_axis, _clockWise);
+ return Interop.Elementary.elm_transit_effect_flip_add(transit, (int)_axis, _clockWise);
+ }
+ }
+
+ /// <summary>
+ /// Resizing effect class.
+ /// </summary>
+ public class ResizingEffect : EffectBase
+ {
+ Size _begin;
+ Size _end;
+
+ /// <summary>
+ /// Creates and initializes a new instance of FlipEffect class.
+ /// </summary>
+ /// <param name="beginSize">The begin Size of the effect</param>
+ /// <param name="endSize">The end Size of the effect</param>
+ public ResizingEffect(Size beginSize, Size endSize)
+ {
+ _begin = beginSize;
+ _end = endSize;
+ }
+
+ /// <summary>
+ /// The begin Size of the effect
+ /// </summary>
+ public Size BeginSize
+ {
+ get { return _begin; }
+ }
+
+ /// <summary>
+ /// The end Size of the effect
+ /// </summary>
+ public Size EndSize
+ {
+ get { return _end; }
+ }
+
+ internal override IntPtr CreateEffect(IntPtr transit)
+ {
+ return Interop.Elementary.elm_transit_effect_resizing_add(transit, _begin.Width, _begin.Height, _end.Width, _end.Height);
+ }
+ }
+
+ /// <summary>
+ /// Rotation effect class.
+ /// </summary>
+ public class RotationEffect : EffectBase
+ {
+ float _begin;
+ float _end;
+
+ /// <summary>
+ /// Creates and initializes a new instance of RotationEffect class.
+ /// </summary>
+ /// <param name="beginDegree">The begin degree of the effect</param>
+ /// <param name="endDegree">The end degree of the effect</param>
+ public RotationEffect(float beginDegree, float endDegree)
+ {
+ _begin = beginDegree;
+ _end = endDegree;
+ }
+
+ /// <summary>
+ /// The begin degree of the effect
+ /// </summary>
+ public float BeginDegree
+ {
+ get { return _begin; }
+ }
+
+ /// <summary>
+ /// The end degree of the effect
+ /// </summary>
+ public float EndDegree
+ {
+ get { return _end; }
+ }
+
+ internal override IntPtr CreateEffect(IntPtr transit)
+ {
+ return Interop.Elementary.elm_transit_effect_rotation_add(transit, _begin, _end);
+ }
+ }
+
+ /// <summary>
+ /// Translation effect class.
+ /// </summary>
+ public class TranslationEffect : EffectBase
+ {
+ Point _begin;
+ Point _end;
+
+ /// <summary>
+ /// Creates and initializes a new instance of FlipEffect class.
+ /// </summary>
+ /// <param name="beginPoint">The begin Point of the effect</param>
+ /// <param name="endPoint">The end Point of the effect</param>
+ public TranslationEffect(Point beginPoint, Point endPoint)
+ {
+ _begin = beginPoint;
+ _end = endPoint;
+ }
+
+ /// <summary>
+ /// The begin Point of the effect
+ /// </summary>
+ public Point BeginPoint
+ {
+ get { return _begin; }
+ }
+
+ /// <summary>
+ /// The end Point of the effect
+ /// </summary>
+ public Point EndPoint
+ {
+ get { return _end; }
+ }
+
+ internal override IntPtr CreateEffect(IntPtr transit)
+ {
+ return Interop.Elementary.elm_transit_effect_translation_add(transit, _begin.X, _begin.Y, _end.X, _end.Y);
+ }
+ }
+
+ /// <summary>
+ /// Wipe effect class.
+ /// </summary>
+ public class WipeEffect : EffectBase
+ {
+ WipeType _type;
+ WipeDirection _direction;
+
+ /// <summary>
+ /// Creates and initializes a new instance of WipeEffect class.
+ /// </summary>
+ /// <param name="type">Wipe type. Hide or show.</param>
+ /// <param name="direction">Wipe Direction.</param>
+ public WipeEffect(WipeType type, WipeDirection direction)
+ {
+ _type = type;
+ _direction = direction;
+ }
+
+ /// <summary>
+ /// Wipe type. Hide or show.
+ /// </summary>
+ public WipeType Type
+ {
+ get { return _type; }
+ }
+
+ /// <summary>
+ /// Wipe Direction.
+ /// </summary>
+ public WipeDirection Direction
+ {
+ get { return _direction; }
+ }
+
+ internal override IntPtr CreateEffect(IntPtr transit)
+ {
+ return Interop.Elementary.elm_transit_effect_wipe_add(transit, (int)_type, (int)_direction);
+ }
+ }
+
+ /// <summary>
+ /// Zoom effect class.
+ /// </summary>
+ public class ZoomEffect : EffectBase
+ {
+ float _begin;
+ float _end;
+
+ /// <summary>
+ /// Creates and initializes a new instance of ZoomEffect class.
+ /// </summary>
+ /// <param name="beginRate">The begin rate of the effect</param>
+ /// <param name="endRate">The end rate of the effect</param>
+ public ZoomEffect(float beginRate, float endRate)
+ {
+ _begin = beginRate;
+ _end = endRate;
+ }
+
+ /// <summary>
+ /// The begin rate of the effect
+ /// </summary>
+ public float BeginRate
+ {
+ get { return _begin; }
+ }
+
+ /// <summary>
+ /// The end rate of the effect
+ /// </summary>
+ public float EndRate
+ {
+ get { return _end; }
+ }
+
+ internal override IntPtr CreateEffect(IntPtr transit)
+ {
+ return Interop.Elementary.elm_transit_effect_zoom_add(transit, _begin, _end);
+ }
+ }
+} \ No newline at end of file