1 #ifndef __DALI_PAGE_TURN_EFFECT_H_
2 #define __DALI_PAGE_TURN_EFFECT_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/animation/constraint.h>
23 #include <dali/public-api/common/stage.h>
24 #include <dali/public-api/object/property-input.h>
25 #include <dali/public-api/shader-effects/shader-effect.h>
39 * @brief Re-applies PageTurnEffect internal constraints
40 * The internal constraint uses the OriginalCenter property and the CurrentCenter Property
41 * to update the variety of common parameters which are with the same value for all the vertices.
42 * Note: For each actor, the constraints are applied in the same order as the calls to Actor::ApplyConstraint().
43 * So if there are other contraints applied to the OriginalCenter or CurrentCenter while when using this effect,
44 * call this method to get the internal constraints and re-apply it afterwards.
46 * @param[in] shaderEffect The page turn effect to which internal constraints should be re-applied
48 void PageTurnApplyInternalConstraint( ShaderEffect& shaderEffect);
51 * @brief Create a new PageTurnEffect
52 * PageTurnEffect is a custom shader effect to achieve page turn effect for Image actors.
56 * // create shader used for doing page-turn effect\n
57 * ShaderEffect pageTurnEffect = CreatePageTurnEffect();
59 * // set image actor shader to the page-turn one\n
60 * // for portrait view, one image actor for each page\n
61 * // for landscape view, the page turned over is still visible, so back image is needed \n
62 * // in this case, create another image Actor using the back image and added to the page actor \n
63 * ImageActor pageActor = ImageActor::New(....); \n
64 * ImageActor backImageActor = ImageActor::New(....); \n
65 * pageActor.Add(backPageActor);\n
66 * pageActor.SetShaderEffect ( pageTurnEffect ); \n
68 * //set initial values
69 * pageTurnEffect.SetUniform("uPageSize", Vector2);\n
70 * pageTurnEffect.SetUniform("uOriginalCenter", Vector2);\n
71 * pageTurnEffect.SetUniform("uIsTurningBack", bool);\n
72 * pageTurnEffect.SetUniform("uCurrentCenter",Vector2);\n
74 * //Animate it with the current center property\n
75 * Animation animation[mAnimationIndex] = Animation::New( ... );\n
76 * animation.AnimateTo(Property( pageTurnEffect, "uCurrentCenter" ),
78 * AlphaFunction::...);\n
79 * animation[mAnimationIndex].Play(); \n
81 * Animatable/Constrainable uniforms:
83 ShaderEffect CreatePageTurnEffect();
85 } // namespace Internal
87 } // namespace Toolkit
91 #endif /* __DALI_TOOLKIT_SC_CURVE_EFFECT_H_ */