Merge "Move TextSelectionPopup from public to devel" into tizen
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / shader-effects / bouncing-effect.h
1 #ifndef __DALI_TOOLKIT_SHADER_EFFECT_BOUNCING_H__
2 #define __DALI_TOOLKIT_SHADER_EFFECT_BOUNCING_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/shader-effects/shader-effect.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 /**
31  * @brief BouncingEffect is a custom overscroll effect with two waves appearing at two sides then moving towards center and overlapping.
32  *
33  * Usage Example:
34  *
35  *  // Create the an imageActor, set shader effect, and add it to the stage
36  *  ImageActor imageActor = ImageActor::New( BufferImage::New( 1, 1 ) );
37  *  imageActor.SetSize(720.f,58.f);
38  *  Toolkit::BouncingEffect bouncingEffect = Toolkit::BouncingEffect::New( Vector4(0.f,1.f,1.f,0.5f) );
39  *  imageActor.SetShaderEffect( bouncingEffect );
40  *  imageActor.SetParentOrigin( ParentOrigin::CENTER );
41  *  Stage::GetCurrent().Add( imageActor );
42  *
43  *   // Start the animation
44  *   Animation animation = Animation::New(1.f);
45  *   animation.AnimateTo( Property( bouncingEffect, bouncingEffect.GetProgressRatePropertyName() ),
46  *                        1.f, AlphaFunction::BOUNCE );
47  *   animation.Play();
48  */
49 class DALI_IMPORT_API BouncingEffect : public ShaderEffect
50 {
51 public:
52
53   /**
54    * @brief Creates an empty BouncingEffect handle
55    */
56   BouncingEffect();
57
58   /**
59    * @brief Destructor
60    *
61    * This is non-virtual since derived Handle types must not contain data or virtual methods.
62    */
63   ~BouncingEffect();
64
65   /**
66    * @brief Create a BouncingEffect object
67    *
68    * @param[in] color The color used on the bouncing stripe
69    * @return A handle to a newly allocated Dali resource.
70    */
71   static BouncingEffect New( const Vector4& color );
72
73   /**
74    * @brief Set the progress rate to the effect.
75    *
76    * The whole progress ( with progress rate from 0.0 to 1.0 ):
77    *      two waves appear at two sides; move towards center and overlap.
78    * @param[in] progressRate The progress rate value.
79    */
80   void SetProgressRate( float progressRate );
81
82   /**
83    * @brief Get the name for the progress rate property.
84    *
85    * @return A std::string containing the property name.
86    */
87   const std::string& GetProgressRatePropertyName() const;
88
89
90 private: // Not intended for application developers
91   DALI_INTERNAL BouncingEffect( ShaderEffect handle );
92
93 };
94
95 } // namespace Toolkit
96
97 } // namespace Dali
98
99 #endif // __DALI_TOOLKIT_SHADER_EFFECT_BOUNCING_H__