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 Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/actors/image-actor.h>
31 namespace Internal DALI_INTERNAL
35 * CubeTransitionEffect implementation class
37 class CubeTransitionEffect;
39 } // namespace Internal
42 * CubeTransitionEffect is a base class of custom transition effect on Image actors
43 * The two images are partitioned into tiles and serves as two perpendicular faces of cubes
44 * By rotating these cubes to transit from one image to another
50 * //create a new CubeTransitionEffect
51 * //use the New funtion of subclass ( CubeTransitionWaveEffect or CubeTransitionCrossEffect )
52 * CubeTransitionEffect cubeEffect = CubeTransitionWaveEffect::New(numRows, numColumns, viewAreaSize);
54 * //set the duration of transition animation
55 * cubeEffect.SetTransitionDuration( animationDuration );
57 * //set the displacement of bouncing movement during cube's rotation
58 * cubeEffect.SetCubeDisplacement( cubeDisplacement );
61 * stage.Add( cubeEffect.GetRoot() );
63 * // Set the current image,
64 * // only need to set at beginning or when the current image was transited to with no effect or other effect
65 * cubeEffect.SetCurrentImage( firstImageActor );
67 * // Set target image, paired with startTransition. These two steps would be repeated as needed
68 * cubeEffect.SetTargetimage( secondImageActor );
69 * // Activate the effect
70 * // no param / param ture: default horizontally left panGesture
71 * // or param false: default horizontally right panGesture
72 * // or params position & displacement: specified the panGesture
73 * cubeEffect.StartTransition( );
77 class DALI_IMPORT_API CubeTransitionEffect : public BaseHandle
82 * Create an uninitialized CubeTransitionEffect;
83 * this can be initialized by New function of its subclass
85 CubeTransitionEffect();
90 ~CubeTransitionEffect();
93 * Set the duration of transition animation
94 * @param[in] duration The duration of transition animation
96 void SetTransitionDuration( float duration );
99 * Get the duration of transition animation
100 * @return duration The duration of transition animation
102 float GetTransitionDuration() const;
105 * Set the displacement of bouncing animation during cube's rotation
106 * @param[in] displacement The displacement of bouncing animation
108 void SetCubeDisplacement( float displacement );
111 * Getet the displacement of bouncing animation during cube's rotation
112 * @return displacement The displacement of bouncing animation
114 float GetCubeDisplacement() const;
117 * Return the transition effect root actor, should then be added to stage
118 * @return The transition effect root actor
123 * Return the transition status
124 * @return True if the transition is under processing; false if finished
129 * Set the current image to transite from
130 * if using this same effect continuely, only need to set once
131 * @param[in] imageActor The current imageActor
133 void SetCurrentImage(ImageActor imageActor);
136 * Set the target image to transit to
137 * @param[in] imageActor The new imageActor showing on stage
139 void SetTargetImage(ImageActor imageActor);
142 * Activate the transition animation with horizontally left/right panGesture
143 * @pre target image is set
144 * @param[in] toNextImage Horizontally left panGesture if ture, horizontally right if false
146 void StartTransition( bool toNextImage = true );
149 * Activate the transition animation with specified panGesture
150 * @pre target image is set
151 * @param[in] panPosition The press down position of panGesture
152 * @param[in] panDisplacement The displacement vector of panGesture
154 void StartTransition( Vector2 panPosition, Vector2 panDisplacement );
157 * Pause the transition animation.
158 * It does nothing if the animation is not running.
160 void PauseTransition();
163 * Re-Activate the transition animation after it is paused by calling PauseTransition().
164 * It does nothing in other cases.
166 void ResumeTransition();
169 * Inactivate the transition animation if it is running.
170 * Also set the rotation and position of cubes, colors of tile to the same as the final state when the animation if finished completely
171 * It does nothing if the animation is not running.
173 void StopTransition();
178 static const char* const SIGNAL_TRANSITION_COMPLETED;
180 //Transition animation completed signal
181 typedef Signal< void ( CubeTransitionEffect, ImageActor ) > TransitionCompletedSignalType;
184 * Signal emitted when the transition has completed animation
185 * A callback of the following type may be connected
187 * void YourCallbackName( CubeTransitionEffect cubeEffect, ImageActor currentImage );
189 * @return The Signal to connect to.
191 TransitionCompletedSignalType& TransitionCompletedSignal();
193 public: // Not intended for developer use
195 explicit DALI_INTERNAL CubeTransitionEffect( Internal::CubeTransitionEffect* impl );
197 }; //class CubeTransitionEffect
199 } // namespace Toolkit
203 #endif /* __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__ */