1 #ifndef __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__
2 #define __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://floralicense.org/license/
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
21 #include <dali/dali.h>
23 namespace Dali DALI_IMPORT_API
29 namespace Internal DALI_INTERNAL
33 * CubeTransitionEffect implementation class
35 class CubeTransitionEffect;
37 } // namespace Internal
40 * CubeTransitionEffect is a base class of custom transition effect on Image actors
41 * The two images are partitioned into tiles and serves as two perpendicular faces of cubes
42 * By rotating these cubes to transit from one image to another
48 * //create a new CubeTransitionEffect
49 * //use the New funtion of subclass ( CubeTransitionWaveEffect or CubeTransitionCrossEffect )
50 * CubeTransitionEffect cubeEffect = CubeTransitionWaveEffect::New(numRows, numColumns, viewAreaSize);
52 * //set the duration of transition animation
53 * cubeEffect.SetTransitionDuration( animationDuration );
55 * //set the displacement of bouncing movement during cube's rotation
56 * cubeEffect.SetCubeDisplacement( cubeDisplacement );
59 * stage.Add( cubeEffect.GetRoot() );
61 * // Set the current image,
62 * // only need to set at beginning or when the current image was transited to with no effect or other effect
63 * cubeEffect.SetCurrentImage( firstImageActor );
65 * // Set target image, paired with startTransition. These two steps would be repeated as needed
66 * cubeEffect.SetTargetimage( secondImageActor );
67 * // Activate the effect
68 * // no param / param ture: default horizontally left panGesture
69 * // or param false: default horizontally right panGesture
70 * // or params position & displacement: specified the panGesture
71 * cubeEffect.StartTransition( );
75 class CubeTransitionEffect : public BaseHandle
80 * Create an uninitialized CubeTransitionEffect;
81 * this can be initialized by New function of its subclass
83 CubeTransitionEffect();
88 ~CubeTransitionEffect();
91 * Set the duration of transition animation
92 * @param[in] duration The duration of transition animation
94 void SetTransitionDuration( float duration );
97 * Get the duration of transition animation
98 * @return duration The duration of transition animation
100 float GetTransitionDuration() const;
103 * Set the displacement of bouncing animation during cube's rotation
104 * @param[in] displacement The displacement of bouncing animation
106 void SetCubeDisplacement( float displacement );
109 * Getet the displacement of bouncing animation during cube's rotation
110 * @return displacement The displacement of bouncing animation
112 float GetCubeDisplacement() const;
115 * Return the transition effect root actor, should then be added to stage
116 * @return The transition effect root actor
121 * Return the transition status
122 * @return True if the transition is under processing; false if finished
127 * Set the current image to transite from
128 * if using this same effect continuely, only need to set once
129 * @param[in] imageActor The current imageActor
131 void SetCurrentImage(ImageActor imageActor);
134 * Set the target image to transit to
135 * @param[in] imageActor The new imageActor showing on stage
137 void SetTargetImage(ImageActor imageActor);
140 * Activate the transition animation with horizontally left/right panGesture
141 * @pre target image is set
142 * @param[in] toNextImage Horizontally left panGesture if ture, horizontally right if false
144 void StartTransition( bool toNextImage = true );
147 * Activate the transition animation with specified panGesture
148 * @pre target image is set
149 * @param[in] panPosition The press down position of panGesture
150 * @param[in] panDisplacement The displacement vector of panGesture
152 void StartTransition( Vector2 panPosition, Vector2 panDisplacement );
155 * Pause the transition animation.
156 * It does nothing if the animation is not running.
158 void PauseTransition();
161 * Re-Activate the transition animation after it is paused by calling PauseTransition().
162 * It does nothing in other cases.
164 void ResumeTransition();
167 * Inactivate the transition animation if it is running.
168 * Also set the rotation and position of cubes, colors of tile to the same as the final state when the animation if finished completely
169 * It does nothing if the animation is not running.
171 void StopTransition();
176 static const char* const SIGNAL_TRANSITION_COMPLETED;
178 //Transition animation completed signal
179 typedef SignalV2< void ( CubeTransitionEffect, ImageActor ) > TransitionCompletedSignalV2;
182 * Signal emitted when the transition has completed animation
183 * A callback of the following type may be connected
185 * void YourCallbackName( CubeTransitionEffect cubeEffect, ImageActor currentImage );
187 * @return The Signal to connect to.
189 TransitionCompletedSignalV2& TransitionCompletedSignal();
191 public: // Not intended for developer use
193 CubeTransitionEffect( Internal::CubeTransitionEffect* impl );
195 }; //class CubeTransitionEffect
197 } // namespace Toolkit
201 #endif /* __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__ */