1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_WOBBLE_EFFECT_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_WOBBLE_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/public-api/animation/animation.h>
22 #include <dali/public-api/animation/alpha-functions.h>
23 #include <dali/public-api/animation/time-period.h>
24 #include <dali/public-api/object/ref-object.h>
25 #include <dali/public-api/actors/custom-actor.h>
26 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
27 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
28 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-wobble-effect.h>
43 class ScrollViewEffect;
46 * @copydoc Toolkit::ScrollViewWobbleEffect
48 class ScrollViewWobbleEffect : public ScrollViewEffect
56 ScrollViewWobbleEffect();
59 * Increases the Stable Count (when this reaches mStableTotal)
60 * Then all constraints are stable, and the animation can stop.
62 void IncrementStableCount();
65 * Returns animation cycle id. Every time a new animation starts
66 * this cycle id is increased.
68 * @return The Animation Cycle id is returned.
70 unsigned int GetAnimationCycleId() const;
75 * @copydoc ScrollViewEffect::OnAttach
77 virtual void OnAttach(Toolkit::ScrollView& scrollView);
80 * @copydoc ScrollViewEffect::OnDetach
82 virtual void OnDetach(Toolkit::ScrollView& scrollView);
87 * A reference counted object may only be deleted by calling Unreference()
89 virtual ~ScrollViewWobbleEffect();
94 * Signal handler, called when the ScrollView starts to move
96 * @param[in] position The current scroll position
98 void OnScrollStart( const Vector3& position );
101 * Signal handler, called when the ScrollView is moving
103 * @param[in] position The current scroll position
105 void OnScrollUpdate( const Vector3& position );
108 * Signal handler, called when the ScrollView has completed movement
110 * @param[in] position The current scroll position
112 void OnScrollComplete( const Vector3& position );
115 * Signal handler, called when the Wobble Effect animation has completed.
117 * @param[in] animation The animation.
119 void OnAnimationFinished( Animation& animation );
122 * Attaches effect to Scroll Actor (ScrollView)
124 * Applies the same wobble effect to each Scroll Actor.
126 * @param[in] actor The attached Actor
128 void AttachActor(Actor actor);
131 * Detaches effect from Scroll Actor (ScrollView)
133 * @param[in] actor The attached Actor
135 void DetachActor(Actor actor);
138 * Continues Animation to time reaches endTime
140 * @param[in] endTime the target time to reach.
142 void ContinueAnimation(float endTime);
146 Animation mAnimation; ///< Animation Timer to drive the wobble effect constraint.
147 Property::Index mPropertyTime; ///< Time property used by wobble effect constraint to calculate timePassed.
149 int mStableCurrent; ///< Stability current - how many wobble constraints are not wobbling (or have neglible wobble).
150 unsigned int mAnimationCycleId; ///< The start of each new animation cycle is a unique number.
154 } // namespace Internal
156 } // namespace Toolkit
160 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_WOBBLE_EFFECT_H__