1 #ifndef __DALI_TOOLKIT_SHADER_EFFECT_BOUNCING_H__
2 #define __DALI_TOOLKIT_SHADER_EFFECT_BOUNCING_H__
5 * Copyright (c) 2015 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/shader-effects/shader-effect.h>
31 * @brief BouncingEffect is a custom overscroll effect with two waves appearing at two sides then moving towards center and overlapping.
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 );
43 * // Start the animation
44 * Animation animation = Animation::New(1.f);
45 * animation.AnimateTo( Property( bouncingEffect, bouncingEffect.GetProgressRatePropertyName() ),
46 * 1.f, AlphaFunction::BOUNCE );
49 class DALI_IMPORT_API BouncingEffect : public ShaderEffect
54 * @brief Creates an empty BouncingEffect handle
61 * This is non-virtual since derived Handle types must not contain data or virtual methods.
66 * @brief Create a BouncingEffect object
68 * @param[in] color The color used on the bouncing stripe
69 * @return A handle to a newly allocated Dali resource.
71 static BouncingEffect New( const Vector4& color );
74 * @brief Set the progress rate to the effect.
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.
80 void SetProgressRate( float progressRate );
83 * @brief Get the name for the progress rate property.
85 * @return A std::string containing the property name.
87 const std::string& GetProgressRatePropertyName() const;
90 private: // Not intended for application developers
91 DALI_INTERNAL BouncingEffect( ShaderEffect handle );
95 } // namespace Toolkit
99 #endif // __DALI_TOOLKIT_SHADER_EFFECT_BOUNCING_H__