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.
34 * @brief Re-applies PageTurnEffect internal constraints
35 * The internal constraint uses the OriginalCenter property and the CURRENT_CENTER Property
36 * to update the variety of common parameters which are with the same value for all the vertices.
37 * Note: For each actor, the constraints are applied in the same order as the calls to Actor::ApplyConstraint().
38 * So if there are other contraints applied to the ORIGINAL_CENTER or CURRENT_CENTER while when using this effect,
39 * call this method to get the internal constraints and re-apply it afterwards.
41 * @param[in] actor The page turn actor to which internal constraints should be re-applied
42 * @param[in] pageHeight The page height.
44 void PageTurnApplyInternalConstraint( Actor& actor, float pageHeight );
47 * @brief Create a new PageTurnEffect
48 * PageTurnEffect is a custom shader to achieve page turn effect for image views.
52 * // create shader used for doing page-turn effect\n
53 * Property::Map pageTurnEffect = CreatePageTurnEffect();
55 * // set image view custom shader to the page-turn one\n
56 * // for portrait view, the image is rendered as the front side of page\n
57 * // for landscape view, the back side becomes visible when the page is turned over. \n
58 * // in this case, the left and right half of the image are renderer as the front and back side separately. \n
59 * ImageView page = ImageView::New(....); \n
60 * page.SetProperty ( ImageView::Property::IMAGE, pageTurnEffect ); \n
62 * //set initial values
63 * page.SetProperty( page.GetPropertyIndex("uIsTurningBack",) bool );\n
64 * page.SetProperty( page.GetPropertyIndex("uSpineShadowParameter",) Vector2 );\n
65 * page.SetProperty( page.GetPropertyIndex("ORIGINAL_CENTER"), Vector2 );\n
66 * page.SetProperty( page.GetPropertyIndex("CURRENT_CENTER"), Vector2 );\n
67 * page.SetProperty( page.GetPropertyIndex("uCommonParameters"), Matrix );\n
68 * page.SetProperty( page.GetPropertyIndex("uTextureWidth"), float ); // Set to 1.0 for single-sided or 2.0 for double-sided \n
69 * PageTurnApplyInternalConstraint( page );\n
71 * //Animate it with the current center property\n
72 * Animation animation = Animation::New( ... );\n
73 * animation.AnimateTo(Property( page, "CURRENT_CENTER" ),
75 * AlphaFunction::...);\n
76 * animation.Play(); \n
79 Property::Map CreatePageTurnEffect();
81 } // namespace Internal
83 } // namespace Toolkit
87 #endif /* __DALI_TOOLKIT_SC_CURVE_EFFECT_H_ */