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( );
78 * | %Signal Name | Method |
79 * |----------------------|----------------------------------|
80 * | transition-completed | @ref TransitionCompletedSignal() |
82 class DALI_IMPORT_API CubeTransitionEffect : public BaseHandle
87 * Create an uninitialized CubeTransitionEffect;
88 * this can be initialized by New function of its subclass
90 CubeTransitionEffect();
95 ~CubeTransitionEffect();
98 * @brief Downcast an Object handle to a CubeTransitionEffect handle.
100 * If handle points to a CubeTransitionEffect object the downcast produces
101 * a valid handle. If not the returned handle is left uninitialized.
103 * @param[in] handle A handle to an object
104 * @return A handle to a CubeTransitionEffect object or an uninitialized handle
106 static CubeTransitionEffect DownCast( BaseHandle handle );
109 * Set the duration of transition animation
110 * @param[in] duration The duration of transition animation
112 void SetTransitionDuration( float duration );
115 * Get the duration of transition animation
116 * @return duration The duration of transition animation
118 float GetTransitionDuration() const;
121 * Set the displacement of bouncing animation during cube's rotation
122 * @param[in] displacement The displacement of bouncing animation
124 void SetCubeDisplacement( float displacement );
127 * Getet the displacement of bouncing animation during cube's rotation
128 * @return displacement The displacement of bouncing animation
130 float GetCubeDisplacement() const;
133 * Return the transition effect root actor, should then be added to stage
134 * @return The transition effect root actor
139 * Return the transition status
140 * @return True if the transition is under processing; false if finished
145 * Set the current image to transite from
146 * if using this same effect continuely, only need to set once
147 * @param[in] imageActor The current imageActor
149 void SetCurrentImage(ImageActor imageActor);
152 * Set the target image to transit to
153 * @param[in] imageActor The new imageActor showing on stage
155 void SetTargetImage(ImageActor imageActor);
158 * Activate the transition animation with horizontally left/right panGesture
159 * @pre target image is set
160 * @param[in] toNextImage Horizontally left panGesture if ture, horizontally right if false
162 void StartTransition( bool toNextImage = true );
165 * Activate the transition animation with specified panGesture
166 * @pre target image is set
167 * @param[in] panPosition The press down position of panGesture
168 * @param[in] panDisplacement The displacement vector of panGesture
170 void StartTransition( Vector2 panPosition, Vector2 panDisplacement );
173 * Pause the transition animation.
174 * It does nothing if the animation is not running.
176 void PauseTransition();
179 * Re-Activate the transition animation after it is paused by calling PauseTransition().
180 * It does nothing in other cases.
182 void ResumeTransition();
185 * Inactivate the transition animation if it is running.
186 * Also set the rotation and position of cubes, colors of tile to the same as the final state when the animation if finished completely
187 * It does nothing if the animation is not running.
189 void StopTransition();
193 //Transition animation completed signal
194 typedef Signal< void ( CubeTransitionEffect, ImageActor ) > TransitionCompletedSignalType;
197 * Signal emitted when the transition has completed animation
198 * A callback of the following type may be connected
200 * void YourCallbackName( CubeTransitionEffect cubeEffect, ImageActor currentImage );
202 * @return The Signal to connect to.
204 TransitionCompletedSignalType& TransitionCompletedSignal();
206 public: // Not intended for developer use
208 explicit DALI_INTERNAL CubeTransitionEffect( Internal::CubeTransitionEffect* impl );
210 }; //class CubeTransitionEffect
212 } // namespace Toolkit
216 #endif /* __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__ */