/* * 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 { /// /// The axis along which flip effect should be applied. /// public enum FlipAxis { /// /// Flip on X axis /// X, /// /// Flip on Y axis /// Y, } /// /// The direction in which the wipe effect should occur. /// public enum WipeDirection { /// /// Wipe to the left /// Left, /// /// Wipe to the right /// Right, /// /// Wipe to the up /// Up, /// /// Wipe to the down /// Down, } /// /// Whether the wipe effect should show or hide the object. /// public enum WipeType { /// /// Hide the object during the animation /// Hide, /// /// Show the object during the animation /// Show, } /// /// The type of acceleration used in the transition. /// public enum TweenMode { /// /// Constant speed /// Linear, /// /// Starts slow, increase speed over time, then decrease again and stop slowly, v1 being a power factor /// Sinusoidal, /// /// Starts fast and decrease speed over time, v1 being a power factor /// Decelerate, /// /// Starts slow and increase speed over time, v1 being a power factor /// Accelerate, /// /// Start at gradient v1, interpolated via power of v2 curve /// DivisorInterpolate, /// /// 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 /// Bounce, /// /// Start at 0.0 then "wobble" like a spring rest position 1.0, and wobble v2 times, with decay factor of v1 /// Spring, /// /// Follow the cubic-bezier curve calculated with the control points (x1, y1), (x2, y2) /// BezierCurve, } /// /// Blend effect class. /// public class BlendEffect : EffectBase { /// /// Creates and initializes a new instance of BlendEffect class. /// public BlendEffect() { } internal override IntPtr CreateEffect(IntPtr transit) { return Interop.Elementary.elm_transit_effect_blend_add(transit); } } /// /// Color effect class. /// public class ColorEffect : EffectBase { Color _begin; Color _end; /// /// Creates and initializes a new instance of ColorEffect class. /// /// The begin color of the effect /// The end color of the effect public ColorEffect(Color beginColor, Color endColor) { _begin = beginColor; _end = endColor; } /// /// The begin color of the effect /// public Color BeginColor { get { return _begin; } } /// /// The end color of the effect /// 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); } } /// /// Fade effect class. /// public class FadeEffect : EffectBase { /// /// Creates and initializes a new instance of FadeEffect class. /// public FadeEffect() { } internal override IntPtr CreateEffect(IntPtr transit) { return Interop.Elementary.elm_transit_effect_fade_add(transit); } } /// /// Flip effect class. /// public class FlipEffect : EffectBase { FlipAxis _axis; bool _clockWise; bool _resizable; /// /// Creates and initializes a new instance of FlipEffect class. /// /// Flipping Axis(X or Y). /// Flipping Direction. True is clock-wise. /// Resizable effect with FlipEffect public FlipEffect(FlipAxis axis, bool clockWise, bool resizable = false) { _axis = axis; _clockWise = clockWise; _resizable = resizable; } /// /// Flipping Axis(X or Y). /// public FlipAxis Axis { get { return _axis; } } /// /// Flipping Direction. True is clock-wise. /// public bool ClockWise { get { return _clockWise; } } /// /// Resizable FlipEffect. /// 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); } } /// /// Resizing effect class. /// public class ResizingEffect : EffectBase { Size _begin; Size _end; /// /// Creates and initializes a new instance of FlipEffect class. /// /// The begin Size of the effect /// The end Size of the effect public ResizingEffect(Size beginSize, Size endSize) { _begin = beginSize; _end = endSize; } /// /// The begin Size of the effect /// public Size BeginSize { get { return _begin; } } /// /// The end Size of the effect /// 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); } } /// /// Rotation effect class. /// public class RotationEffect : EffectBase { float _begin; float _end; /// /// Creates and initializes a new instance of RotationEffect class. /// /// The begin degree of the effect /// The end degree of the effect public RotationEffect(float beginDegree, float endDegree) { _begin = beginDegree; _end = endDegree; } /// /// The begin degree of the effect /// public float BeginDegree { get { return _begin; } } /// /// The end degree of the effect /// public float EndDegree { get { return _end; } } internal override IntPtr CreateEffect(IntPtr transit) { return Interop.Elementary.elm_transit_effect_rotation_add(transit, _begin, _end); } } /// /// Translation effect class. /// public class TranslationEffect : EffectBase { Point _begin; Point _end; /// /// Creates and initializes a new instance of FlipEffect class. /// /// The begin Point of the effect /// The end Point of the effect public TranslationEffect(Point beginPoint, Point endPoint) { _begin = beginPoint; _end = endPoint; } /// /// The begin Point of the effect /// public Point BeginPoint { get { return _begin; } } /// /// The end Point of the effect /// 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); } } /// /// Wipe effect class. /// public class WipeEffect : EffectBase { WipeType _type; WipeDirection _direction; /// /// Creates and initializes a new instance of WipeEffect class. /// /// Wipe type. Hide or show. /// Wipe Direction. public WipeEffect(WipeType type, WipeDirection direction) { _type = type; _direction = direction; } /// /// Wipe type. Hide or show. /// public WipeType Type { get { return _type; } } /// /// Wipe Direction. /// 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); } } /// /// Zoom effect class. /// public class ZoomEffect : EffectBase { float _begin; float _end; /// /// Creates and initializes a new instance of ZoomEffect class. /// /// The begin rate of the effect /// The end rate of the effect public ZoomEffect(float beginRate, float endRate) { _begin = beginRate; _end = endRate; } /// /// The begin rate of the effect /// public float BeginRate { get { return _begin; } } /// /// The end rate of the effect /// public float EndRate { get { return _end; } } internal override IntPtr CreateEffect(IntPtr transit) { return Interop.Elementary.elm_transit_effect_zoom_add(transit, _begin, _end); } } }