Commit ddd67499ce55523432d8f344961efb2e512221dc

Authored by Ferran Sole
1 parent a81931fc

Removed unused scroll-view effect changes

Change-Id: I6555f2a4ca0578641c3a53d7ad1b217fa46c1c9a
demo/dali-table-view.cpp
... ... @@ -65,6 +65,8 @@ const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap
65 65 const float EFFECT_FLICK_DURATION = 0.5f; ///< Scroll Flick Duration for Effects
66 66 const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f);
67 67  
  68 +
  69 +
68 70 const int NUM_BACKGROUND_IMAGES = 18;
69 71 const float BACKGROUND_SWIPE_SCALE = 0.025f;
70 72 const float BACKGROUND_SPREAD_SCALE = 1.5f;
... ... @@ -80,19 +82,6 @@ const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f );
80 82 const float BUBBLE_MIN_Z = -1.0;
81 83 const float BUBBLE_MAX_Z = 0.0f;
82 84  
83   -// 3D Effect constants
84   -const Vector2 ANGLE_SWING_3DEFFECT( Math::PI_2 * 0.75, Math::PI_2 * 0.75f ); ///< Angle Swing in radians
85   -const Vector2 POSITION_SWING_3DEFFECT( 0.55f, 0.4f ); ///< Position Swing relative to stage size.
86   -const Vector3 ANCHOR_3DEFFECT_STYLE0( -105.0f, 30.0f, -240.0f ); ///< Rotation Anchor position for 3D Effect (Style 0)
87   -const Vector3 ANCHOR_3DEFFECT_STYLE1( 65.0f, -70.0f, -500.0f ); ///< Rotation Anchor position for 3D Effect (Style 1)
88   -
89   -Vector3 ScalePointSize(const Vector3& vec)
90   -{
91   - return Vector3( DemoHelper::ScalePointSize( vec.x ), DemoHelper::ScalePointSize( vec.y ), DemoHelper::ScalePointSize( vec.z ) );
92   -}
93   -
94   -#define DP(x) DemoHelper::ScalePointSize(x)
95   -
96 85 /**
97 86 * Creates the background image
98 87 */
... ... @@ -318,7 +307,7 @@ void DaliTableView::Initialize( Application&amp; application )
318 307 Populate();
319 308  
320 309 // Remove constraints for inner cube effect
321   - ApplyCubeEffectToActors();
  310 + ApplyCubeEffectToPages();
322 311  
323 312 Dali::Window winHandle = application.GetWindow();
324 313 winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT );
... ... @@ -346,21 +335,14 @@ void DaliTableView::Initialize( Application&amp; application )
346 335 KeyboardFocusManager::Get().FocusedActorActivatedSignal().Connect( this, &DaliTableView::OnFocusedActorActivated );
347 336 }
348 337  
349   -void DaliTableView::ApplyCubeEffectToActors()
  338 +void DaliTableView::ApplyCubeEffectToPages()
350 339 {
  340 + ScrollViewPagePathEffect effect = ScrollViewPagePathEffect::DownCast( mScrollViewEffect );
  341 + unsigned int pageCount(0);
351 342 for( std::vector< Actor >::iterator pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter )
352 343 {
353 344 Actor page = *pageIter;
354   -
355   - for( unsigned int i = 0, numChildren = page.GetChildCount(); i < numChildren; ++i)
356   - {
357   - // Remove old effect's manual constraints.
358   - Actor child = page.GetChildAt(i);
359   - if( child )
360   - {
361   - ApplyCubeEffectToActor( child );
362   - }
363   - }
  345 + effect.ApplyToPage( page, pageCount++ );
364 346 }
365 347 }
366 348  
... ... @@ -446,9 +428,9 @@ void DaliTableView::Populate()
446 428 }
447 429  
448 430 // Update Ruler info.
449   - mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x );
  431 + mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f );
450 432 mScrollRulerY = new DefaultRuler();
451   - mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * TABLE_RELATIVE_SIZE.x, true ) );
  433 + mScrollRulerX->SetDomain( RulerDomain( 0.0f, (mTotalPages+1) * stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f, true ) );
452 434 mScrollRulerY->Disable();
453 435 mScrollView.SetRulerX( mScrollRulerX );
454 436 mScrollView.SetRulerY( mScrollRulerY );
... ... @@ -681,21 +663,29 @@ void DaliTableView::ApplyScrollViewEffect()
681 663  
682 664 void DaliTableView::SetupInnerPageCubeEffect()
683 665 {
684   - mScrollViewEffect = ScrollViewCubeEffect::New();
685   - mScrollView.SetScrollSnapDuration( EFFECT_SNAP_DURATION );
686   - mScrollView.SetScrollFlickDuration( EFFECT_FLICK_DURATION );
687   - mScrollView.RemoveConstraintsFromChildren();
688   -}
689   -
690   -void DaliTableView::ApplyCubeEffectToActor( Actor actor )
691   -{
692   - actor.RemoveConstraints();
  666 + const Vector2 stageSize = Stage::GetCurrent().GetSize();
693 667  
694   - ScrollViewCubeEffect cubeEffect = ScrollViewCubeEffect::DownCast(mScrollViewEffect);
695   - cubeEffect.ApplyToActor( actor,
696   - ScalePointSize( ( rand() & 1 ) ? ANCHOR_3DEFFECT_STYLE0 : ANCHOR_3DEFFECT_STYLE1 ),
697   - ANGLE_SWING_3DEFFECT,
698   - POSITION_SWING_3DEFFECT * Vector2(Stage::GetCurrent().GetSize()));
  668 + Dali::Path path = Dali::Path::New();
  669 + Dali::Property::Array points;
  670 + points.Resize(3);
  671 + points[0] = Vector3( stageSize.x*0.5, 0.0f, stageSize.x*0.5f);
  672 + points[1] = Vector3( 0.0f, 0.0f, 0.0f );
  673 + points[2] = Vector3( -stageSize.x*0.5f, 0.0f, stageSize.x*0.5f);
  674 + path.SetProperty( Path::Property::POINTS, points );
  675 +
  676 + Dali::Property::Array controlPoints;
  677 + controlPoints.Resize(4);
  678 + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
  679 + controlPoints[1] = Vector3( stageSize.x*0.3f, 0.0f, 0.0f );
  680 + controlPoints[2] = Vector3(-stageSize.x*0.3f, 0.0f, 0.0f );
  681 + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
  682 + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
  683 +
  684 +
  685 + mScrollViewEffect = ScrollViewPagePathEffect::New(path,
  686 + Vector3(-1.0f,0.0f,0.0f),
  687 + Toolkit::ScrollView::Property::SCROLL_FINAL_X,
  688 + Vector3(stageSize.x*TABLE_RELATIVE_SIZE.x,stageSize.y*TABLE_RELATIVE_SIZE.y,0.0f),mTotalPages);
699 689 }
700 690  
701 691 void DaliTableView::OnKeyEvent( const KeyEvent& event )
... ...
demo/dali-table-view.h
... ... @@ -245,7 +245,7 @@ private: // Application callbacks &amp; implementation
245 245 /**
246 246 * Apply the cube effect to all the page actors
247 247 */
248   - void ApplyCubeEffectToActors();
  248 + void ApplyCubeEffectToPages();
249 249  
250 250 /**
251 251 * Setup the inner cube effect
... ... @@ -253,11 +253,6 @@ private: // Application callbacks &amp; implementation
253 253 void SetupInnerPageCubeEffect();
254 254  
255 255 /**
256   - * Apply the cube effect to an actor
257   - */
258   - void ApplyCubeEffectToActor( Dali::Actor actor );
259   -
260   - /**
261 256 * Apply a shader effect to a table tile
262 257 */
263 258 void ApplyEffectToTile(Dali::Actor tile);
... ...
examples/cluster/cluster-example.cpp
... ... @@ -38,7 +38,7 @@ const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR &quot;background-default.png&quot; );
38 38 const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
39 39 const char * const APPLICATION_TITLE( "Clusters" );
40 40 const char * const LAYOUT_NONE_IMAGE( DALI_IMAGE_DIR "icon-cluster-none.png" );
41   -const char * const LAYOUT_WOBBLE_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" );
  41 +const char * const LAYOUT_MOTION_BLUR_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" );
42 42 const char * const LAYOUT_CAROUSEL_IMAGE( DALI_IMAGE_DIR "icon-cluster-carousel.png" );
43 43 const char * const LAYOUT_SPHERE_IMAGE( DALI_IMAGE_DIR "icon-cluster-sphere.png" );
44 44  
... ... @@ -134,9 +134,6 @@ const float CLUSTER_GROUP_DELAY_BOTTOM = 0.0f; ///&lt; Delay for botto
134 134 const float CLUSTER_COLUMN_INDENT = 0.1f; ///< Left Indentation in screen coordinates.
135 135 const float CLUSTER_ROW_INDENT = 0.13f; ///< Top Indentation in screen coordinates.
136 136  
137   -const Vector3 SHEAR_EFFECT_ANCHOR_POINT(0.5f, 1.0f, 0.5f); ///< Anchor Point used for the shear effect (extends outside of Cluster)
138   -const float SHEAR_EFFECT_MAX_OVERSHOOT = 30.0f; ///< Max Overshoot for shear effect (in degrees).
139   -
140 137 const float UI_MARGIN = 10.0f; ///< Screen Margin for placement of UI buttons
141 138  
142 139 const float CAROUSEL_EFFECT_RADIUS = 500.0f; ///< In Carousel Effect mode: Radius of carousel (Z peak depth)
... ... @@ -152,7 +149,7 @@ const float SPHERE_EFFECT_VERTICAL_DOMAIN = 0.15f; ///&lt; In Sphere Effec
152 149 enum ExampleEffectType
153 150 {
154 151 NO_EFFECT,
155   - WOBBLE_EFFECT,
  152 + MOTION_BLUR_EFFECT,
156 153 CAROUSEL_EFFECT,
157 154 SPHERE_EFFECT,
158 155 TOTAL_EFFECTS
... ... @@ -161,10 +158,10 @@ enum ExampleEffectType
161 158 /**
162 159 * List of effect type names that appear on the Effect button.
163 160 */
164   -const char* EXAMPLE_EFFECT_LABEL[] = { "NONE",
165   - "WOBBLE",
166   - "CAROUSEL",
167   - "SPHERE",
  161 +const char* EXAMPLE_EFFECT_LABEL[] = { "None",
  162 + "Motion Blur",
  163 + "Carousel",
  164 + "Sphere",
168 165 };
169 166  
170 167 /**
... ... @@ -205,96 +202,6 @@ struct CarouselEffectOrientationConstraint
205 202 };
206 203  
207 204 /**
208   - * ShearEffectConstraint
209   - *
210   - * Constrains ShearEffect's tilt to be a function of scrollview's
211   - * horizontal overshoot amount.
212   - */
213   -struct ShearEffectConstraint
214   -{
215   - /**
216   - * @param[in] stageSize The stage size (not subject to orientation)
217   - * @param[in] maxOvershoot Maximum amount overshoot can affect shear.
218   - * @param[in] componentMask Whether constraint should take the X shear
219   - * or the Y shear component.
220   - */
221   - ShearEffectConstraint(Vector2 stageSize, float maxOvershoot, Vector2 componentMask)
222   - : mStageSize(stageSize),
223   - mMaxOvershoot(maxOvershoot),
224   - mComponentMask(componentMask)
225   - {
226   - }
227   -
228   - /**
229   - * @param[in,out] current The current shear effect Angle.
230   - * @param[in] inputs Contains the overshoot property from ScrollView and the orientation of the view e.g. Portrait, Landscape.
231   - * @return angle to provide ShearShaderEffect
232   - */
233   - void operator()( float& current, const PropertyInputContainer& inputs )
234   - {
235   - float f = inputs[0]->GetVector3().x;
236   -
237   - float mag = fabsf(f);
238   - float halfWidth = mStageSize.x * 0.5f;
239   -
240   - // inverse exponential tail-off
241   - float overshoot = 1.0f - halfWidth / (halfWidth + mag);
242   - if (f > 0.0f)
243   - {
244   - overshoot = -overshoot;
245   - }
246   -
247   - // Channel this shear value into either the X or Y axis depending on
248   - // the component mask passed in.
249   - Vector3 axis;
250   - Radian angle;
251   - inputs[1]->GetQuaternion().ToAxisAngle( axis, angle );
252   - Vector2 direction( cosf(angle), sinf(angle) );
253   - float yield = direction.x * mComponentMask.x + direction.y * mComponentMask.y;
254   -
255   - current = overshoot * mMaxOvershoot * yield;
256   - }
257   -
258   - Vector2 mStageSize;
259   - float mMaxOvershoot;
260   - Vector2 mComponentMask;
261   -};
262   -
263   -/**
264   - * ShearEffectCenterConstraint
265   - *
266   - * Sets ShearEffect's center to be a function of the
267   - * screen orientation (portrait or landscape).
268   - */
269   -struct ShearEffectCenterConstraint
270   -{
271   - /**
272   - * @param[in] stageSize The stage size (not subject to orientation)
273   - * @param[in] center Shear Center position based on initial orientation.
274   - */
275   - ShearEffectCenterConstraint(Vector2 stageSize, Vector2 center)
276   - : mStageSize(stageSize),
277   - mCenter(center)
278   - {
279   - }
280   -
281   - /**
282   - * @param[in,out] current The current center
283   - * @param[in] inputs Contains the current view size
284   - * @return vector to provide ShearShaderEffect
285   - */
286   - void operator()( Vector2& current, const PropertyInputContainer& inputs )
287   - {
288   - float f = inputs[0]->GetVector3().width / mStageSize.width;
289   - current.x = f * mCenter.x;
290   - current.y = mCenter.y;
291   - }
292   -
293   - Vector2 mStageSize;
294   - Vector2 mCenter;
295   -};
296   -
297   -/**
298 205 * SphereEffectOffsetConstraint
299 206 *
300 207 * Sets SphereEffect's center to be a function of the
... ... @@ -470,7 +377,7 @@ public:
470 377  
471 378 // Create a effect toggle button. (right of toolbar)
472 379 mLayoutButtonImages[ NO_EFFECT ] = ResourceImage::New( LAYOUT_NONE_IMAGE );
473   - mLayoutButtonImages[ WOBBLE_EFFECT ] = ResourceImage::New( LAYOUT_WOBBLE_IMAGE );
  380 + mLayoutButtonImages[ MOTION_BLUR_EFFECT ] = ResourceImage::New( LAYOUT_MOTION_BLUR_IMAGE );
474 381 mLayoutButtonImages[ CAROUSEL_EFFECT ] = ResourceImage::New( LAYOUT_CAROUSEL_IMAGE );
475 382 mLayoutButtonImages[ SPHERE_EFFECT ] = ResourceImage::New( LAYOUT_SPHERE_IMAGE );
476 383  
... ... @@ -482,10 +389,6 @@ public:
482 389 mScrollView = ScrollView::New();
483 390 mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
484 391  
485   - // attach Wobble Effect to ScrollView
486   - mScrollViewEffect = ScrollViewWobbleEffect::New();
487   - mScrollView.ApplyEffect(mScrollViewEffect);
488   -
489 392 // anchor the scroll view from its center point to the middle of its parent
490 393 mScrollView.SetAnchorPoint(AnchorPoint::CENTER);
491 394 mScrollView.SetParentOrigin(ParentOrigin::CENTER);
... ... @@ -506,7 +409,7 @@ public:
506 409 AddCluster( MUSIC, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle2) );
507 410 AddCluster( MAGAZINE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle3) );
508 411  
509   - SetEffect(WOBBLE_EFFECT);
  412 + SetEffect(MOTION_BLUR_EFFECT);
510 413 }
511 414  
512 415 /**
... ... @@ -627,7 +530,7 @@ public:
627 530 pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f));
628 531 pageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
629 532  
630   - // Create cluster actors, add them to scroll view, and set the shear effect with the given center point.
  533 + // Create cluster actors and add them to scroll view
631 534 Vector3 clusterSize;
632 535 Cluster cluster = CreateClusterActor( clusterType, style, clusterSize );
633 536 cluster.SetParentOrigin(ParentOrigin::TOP_LEFT);
... ... @@ -642,6 +545,39 @@ public:
642 545 }
643 546  
644 547 /**
  548 + * Sets motion blur effect to a cluster and all its children
  549 + *
  550 + * @param[in] actor Cluster control to which the effect will be applied
  551 + */
  552 + void SetMotionBlurEffect( Actor actor )
  553 + {
  554 + // only do something if the actor and effect are valid
  555 + if( actor )
  556 + {
  557 + // first remove from this actor
  558 + RenderableActor renderable = RenderableActor::DownCast( actor );
  559 + if( renderable )
  560 + {
  561 + MotionBlurEffect shaderEffect = MotionBlurEffect::New();
  562 + shaderEffect.SetSpeedScalingFactor(0.1f);
  563 +
  564 + Dali::Property::Index uModelProperty = shaderEffect.GetPropertyIndex( "uModelLastFrame" );
  565 + Constraint constraint = Constraint::New<Matrix>( shaderEffect, uModelProperty, EqualToConstraint() );
  566 + constraint.AddSource( Source( actor , Actor::Property::WORLD_MATRIX ) );
  567 + constraint.Apply();
  568 + renderable.SetShaderEffect( shaderEffect );
  569 + }
  570 + // then all children recursively
  571 + const unsigned int count = actor.GetChildCount();
  572 + for( unsigned int index = 0; index < count; ++index )
  573 + {
  574 + Actor child( actor.GetChildAt( index ) );
  575 + SetMotionBlurEffect( child );
  576 + }
  577 + }
  578 + }
  579 +
  580 + /**
645 581 * Resets ScrollView and Clusters settings
646 582 * to reflect the new ExampleEffectType
647 583 *
... ... @@ -701,42 +637,11 @@ public:
701 637 break;
702 638 }
703 639  
704   - case WOBBLE_EFFECT:
  640 + case MOTION_BLUR_EFFECT:
705 641 {
706 642 for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i )
707 643 {
708   - Cluster cluster = i->mCluster;
709   - Vector3 position = i->mPosition;
710   - Vector3 size = i->mSize;
711   -
712   - ShearEffect shaderEffect = ShearEffect::New();
713   - Vector3 shearAnchor = SHEAR_EFFECT_ANCHOR_POINT;
714   -
715   - Vector2 shearCenter( Vector2(position.x + size.width * shearAnchor.x, position.y + size.height * shearAnchor.y) );
716   - Property::Index centerProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetCenterPropertyName());
717   - Constraint constraint = Constraint::New<Vector2>( shaderEffect, centerProperty, ShearEffectCenterConstraint(stageSize, shearCenter) );
718   - constraint.AddSource( Source(mView, Actor::Property::SIZE) );
719   -
720   - constraint.Apply();
721   -
722   - SetShaderEffectRecursively( cluster,shaderEffect );
723   -
724   - // Apply Constraint to Shader Effect
725   - Property::Index scrollOvershootProperty = /*targetGroup*/mScrollView.GetPropertyIndex(ScrollViewWobbleEffect::EFFECT_OVERSHOOT);
726   - Property::Index angleXAxisProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetAngleXAxisPropertyName());
727   - Property::Index angleYAxisProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetAngleYAxisPropertyName());
728   -
729   - constraint = Constraint::New<float>( shaderEffect, angleXAxisProperty, ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) );
730   - constraint.AddSource( Source(mScrollView, scrollOvershootProperty) );
731   - constraint.AddSource( Source(mView, Actor::Property::ORIENTATION) );
732   - constraint.Apply();
733   -
734   - constraint = Constraint::New<float>( shaderEffect, angleYAxisProperty, ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS ) );
735   - constraint.AddSource( Source(mScrollView, scrollOvershootProperty) );
736   - constraint.AddSource( Source(mView, Actor::Property::ORIENTATION) );
737   - constraint.Apply();
738   -
739   -
  644 + SetMotionBlurEffect( i->mCluster );
740 645 }
741 646 break;
742 647 }
... ... @@ -852,7 +757,6 @@ private:
852 757 Layer mContentLayer; ///< Content layer (scrolling cluster content)
853 758  
854 759 ScrollView mScrollView; ///< The ScrollView container for all clusters
855   - ScrollViewWobbleEffect mScrollViewEffect; ///< ScrollView Wobble effect
856 760 Image mClusterBorderImage; ///< The border frame that appears on each image
857 761  
858 762 std::vector<ClusterInfo> mClusterInfo; ///< Keeps track of each cluster's information.
... ...
examples/scroll-view/scroll-view-example.cpp
... ... @@ -31,15 +31,11 @@ namespace
31 31 const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" );
32 32 const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
33 33 const char * const APPLICATION_TITLE( "ScrollView" );
34   -const char * const EFFECT_DEPTH_IMAGE( DALI_IMAGE_DIR "icon-scroll-view-depth.png" );
35   -const char * const EFFECT_INNER_CUBE_IMAGE( DALI_IMAGE_DIR "icon-scroll-view-inner-cube.png" );
36 34 const char * const EFFECT_CAROUSEL_IMAGE( DALI_IMAGE_DIR "icon-scroll-view-carousel.png" );
37 35  
38 36 const Vector3 ICON_SIZE(100.0f, 100.0f, 0.0f);
39 37  
40 38 const char* EFFECT_MODE_NAME[] = {
41   - "Depth",
42   - "Cube",
43 39 "PageCarousel",
44 40 "PageCube",
45 41 "PageSpiral",
... ... @@ -120,25 +116,6 @@ const int PAGE_COLUMNS = 10; ///&lt;
120 116 const int PAGE_ROWS = 1; ///< Number of Pages going down (rows)
121 117 const int IMAGE_ROWS = 5; ///< Number of Images going down (rows) with a Page
122 118  
123   -// 3D Effect constants
124   -const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.2f, Math::PI * 0.2f, 0.0f); ///< Cube page rotates as if it has ten sides with the camera positioned inside
125   -const Vector2 ANGLE_CUSTOM_CUBE_SWING(-Math::PI * 0.45f, -Math::PI * 0.45f); ///< outer cube pages swing 90 degrees as they pan offscreen
126   -const Vector2 ANGLE_SPIRAL_SWING_IN(Math::PI * 0.45f, Math::PI * 0.45f);
127   -const Vector2 ANGLE_SPIRAL_SWING_OUT(Math::PI * 0.3f, Math::PI * 0.3f);
128   -
129   -// Depth Effect constants
130   -const Vector2 POSITION_EXTENT_DEPTH_EFFECT(0.5f, 2.5f); ///< Extent of X & Y position to alter function exponent.
131   -const Vector2 OFFSET_EXTENT_DEPTH_EFFECT(1.0f, 1.0f); ///< Function exponent offset constant.
132   -const float POSITION_SCALE_DEPTH_EFFECT(1.5f); ///< Position scaling.
133   -const float SCALE_EXTENT_DEPTH_EFFECT(0.5f); ///< Maximum scale factor when Actors scrolled one page away (50% size)
134   -
135   -// 3D Effect constants
136   -const Vector2 ANGLE_SWING_3DEFFECT(Math::PI_2 * 0.75, Math::PI_2 * 0.75f); ///< Angle Swing in radians
137   -const Vector2 POSITION_SWING_3DEFFECT(0.25f, 0.25f); ///< Position Swing relative to stage size.
138   -const Vector3 ANCHOR_3DEFFECT_STYLE0(-105.0f, 30.0f, -240.0f); ///< Rotation Anchor position for 3D Effect (Style 0)
139   -const Vector3 ANCHOR_3DEFFECT_STYLE1(65.0f, -70.0f, -300.0f); ///< Rotation Anchor position for 3D Effect (Style 1)
140   -
141   -
142 119 const unsigned int IMAGE_THUMBNAIL_WIDTH = 256; ///< Width of Thumbnail Image in texels
143 120 const unsigned int IMAGE_THUMBNAIL_HEIGHT = 256; ///< Height of Thumbnail Image in texels
144 121  
... ... @@ -164,7 +141,7 @@ public:
164 141 : mApplication( application ),
165 142 mView(),
166 143 mScrolling(false),
167   - mEffectMode(CubeEffect)
  144 + mEffectMode(PageCarouselEffect)
168 145 {
169 146 // Connect to the Application's Init and orientation changed signal
170 147 mApplication.InitSignal().Connect(this, &ExampleController::OnInit);
... ... @@ -197,8 +174,6 @@ public:
197 174 TOOLBAR_IMAGE,
198 175 "" );
199 176  
200   - mEffectIcon[ DepthEffect ] = ResourceImage::New( EFFECT_DEPTH_IMAGE );
201   - mEffectIcon[ CubeEffect ] = ResourceImage::New( EFFECT_INNER_CUBE_IMAGE );
202 177 mEffectIcon[ PageCarouselEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE );
203 178 mEffectIcon[ PageCubeEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE );
204 179 mEffectIcon[ PageSpiralEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE );
... ... @@ -281,18 +256,6 @@ private:
281 256 {
282 257 Actor page = *pageIter;
283 258 ApplyEffectToPage( page, pageCount++ );
284   -
285   - unsigned int numChildren = (*pageIter).GetChildCount();
286   - for(unsigned int i=0; i<numChildren; ++i)
287   - {
288   - Actor image = (*pageIter).GetChildAt(i);
289   -
290   - // Remove old effect's manual constraints.
291   - image.RemoveConstraints();
292   -
293   - // Apply new effect's manual constraints.
294   - ApplyEffectToActor( image, page );
295   - }
296 259 }
297 260 }
298 261  
... ... @@ -353,127 +316,89 @@ private:
353 316 rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * PAGE_COLUMNS, !wrap));
354 317 rulerY->Disable();
355 318  
356   - switch( mEffectMode )
  319 + Dali::Path path = Dali::Path::New();
  320 + Dali::Property::Array points;
  321 + points.Resize(3);
  322 + Dali::Property::Array controlPoints;
  323 + controlPoints.Resize(4);
  324 + Vector3 forward;
  325 + if( mEffectMode == PageCarouselEffect)
357 326 {
358   - case DepthEffect:
359   - {
360   - mScrollViewEffect = ScrollViewDepthEffect::New();
361   - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION);
362   - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION);
363   - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT);
364   - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT);
365   - mScrollView.RemoveConstraintsFromChildren();
366   - break;
367   - }
368 327  
369   - case CubeEffect:
370   - {
371   - mScrollViewEffect = ScrollViewCubeEffect::New();
372   - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION);
373   - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION);
374   - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT_BACK);
375   - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT_BACK);
376   - mScrollView.RemoveConstraintsFromChildren();
377   - break;
378   - }
  328 + points[0] = Vector3( stageSize.x*0.75, 0.0f, -stageSize.x*0.75f);
  329 + points[1] = Vector3( 0.0f, 0.0f, 0.0f );
  330 + points[2] = Vector3( -stageSize.x*0.75f, 0.0f, -stageSize.x*0.75f);
  331 + path.SetProperty( Path::Property::POINTS, points );
379 332  
380   - case PageCarouselEffect:
381   - case PageCubeEffect:
382   - case PageSpiralEffect:
383   - case PageWaveEffect:
384   - {
385   - Dali::Path path = Dali::Path::New();
386   - Dali::Property::Array points;
387   - points.Resize(3);
388   - Dali::Property::Array controlPoints;
389   - controlPoints.Resize(4);
390   - Vector3 forward;
391   - if( mEffectMode == PageCarouselEffect)
392   - {
393   -
394   - points[0] = Vector3( stageSize.x*0.75, 0.0f, -stageSize.x*0.75f);
395   - points[1] = Vector3( 0.0f, 0.0f, 0.0f );
396   - points[2] = Vector3( -stageSize.x*0.75f, 0.0f, -stageSize.x*0.75f);
397   - path.SetProperty( Path::Property::POINTS, points );
398   -
399   - controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
400   - controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
401   - controlPoints[2] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
402   - controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
403   - path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
404   -
405   - forward = Vector3::ZERO;
406   - }
407   - else if( mEffectMode == PageCubeEffect)
408   - {
409   - points[0] = Vector3( stageSize.x*0.5, 0.0f, stageSize.x*0.5f);
410   - points[1] = Vector3( 0.0f, 0.0f, 0.0f );
411   - points[2] = Vector3( -stageSize.x*0.5f, 0.0f, stageSize.x*0.5f);
412   - path.SetProperty( Path::Property::POINTS, points );
413   -
414   - controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
415   - controlPoints[1] = Vector3( stageSize.x*0.3f, 0.0f, 0.0f );
416   - controlPoints[2] = Vector3(-stageSize.x*0.3f, 0.0f, 0.0f );
417   - controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
418   - path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
419   -
420   - forward = Vector3(-1.0f,0.0f,0.0f);
421   - }
422   - else if( mEffectMode == PageSpiralEffect)
423   - {
424   - points[0] = Vector3( stageSize.x*0.5, 0.0f, -stageSize.x*0.5f);
425   - points[1] = Vector3( 0.0f, 0.0f, 0.0f );
426   - points[2] = Vector3( -stageSize.x*0.5f, 0.0f, -stageSize.x*0.5f);
427   - path.SetProperty( Path::Property::POINTS, points );
428   -
429   - controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
430   - controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
431   - controlPoints[2] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
432   - controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
433   - path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
434   -
435   - forward = Vector3(-1.0f,0.0f,0.0f);
436   - }
437   - else if( mEffectMode == PageWaveEffect)
438   - {
439   - points[0] = Vector3( stageSize.x, 0.0f, -stageSize.x);
440   - points[1] = Vector3( 0.0f, 0.0f, 0.0f );
441   - points[2] = Vector3( -stageSize.x, 0.0f, -stageSize.x);
442   - path.SetProperty( Path::Property::POINTS, points );
443   -
444   - controlPoints[0] = Vector3( 0.0f, 0.0f, -stageSize.x );
445   - controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
446   - controlPoints[2] = Vector3( -stageSize.x*0.5f, 0.0f, 0.0f);
447   - controlPoints[3] = Vector3(0.0f, 0.0f,-stageSize.x );
448   - path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
449   -
450   - forward = Vector3(-1.0f,0.0f,0.0f);
451   - }
452   -
453   - mScrollViewEffect = ScrollViewPagePathEffect::New(path, forward,Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(stageSize.x,stageSize.y,0.0f),PAGE_COLUMNS);
454   - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION);
455   - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION);
456   - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT);
457   - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT);
458   - mScrollView.RemoveConstraintsFromChildren();
459   -
460   - rulerX = CreateRuler(snap ? stageSize.width * 0.5f : 0.0f);
461   - if( wrap )
462   - {
463   - rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * 0.5f * PAGE_COLUMNS, !wrap));
464   - }
465   - else
466   - {
467   - rulerX->SetDomain(RulerDomain(0.0f, stageSize.x*0.5f* (PAGE_COLUMNS+1), !wrap));
468   - }
469   -
470   - break;
471   - }
  333 + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
  334 + controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
  335 + controlPoints[2] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
  336 + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
  337 + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
472 338  
473   - default:
474   - {
475   - break;
476   - }
  339 + forward = Vector3::ZERO;
  340 + }
  341 + else if( mEffectMode == PageCubeEffect)
  342 + {
  343 + points[0] = Vector3( stageSize.x*0.5, 0.0f, stageSize.x*0.5f);
  344 + points[1] = Vector3( 0.0f, 0.0f, 0.0f );
  345 + points[2] = Vector3( -stageSize.x*0.5f, 0.0f, stageSize.x*0.5f);
  346 + path.SetProperty( Path::Property::POINTS, points );
  347 +
  348 + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
  349 + controlPoints[1] = Vector3( stageSize.x*0.3f, 0.0f, 0.0f );
  350 + controlPoints[2] = Vector3(-stageSize.x*0.3f, 0.0f, 0.0f );
  351 + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
  352 + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
  353 +
  354 + forward = Vector3(-1.0f,0.0f,0.0f);
  355 + }
  356 + else if( mEffectMode == PageSpiralEffect)
  357 + {
  358 + points[0] = Vector3( stageSize.x*0.5, 0.0f, -stageSize.x*0.5f);
  359 + points[1] = Vector3( 0.0f, 0.0f, 0.0f );
  360 + points[2] = Vector3( -stageSize.x*0.5f, 0.0f, -stageSize.x*0.5f);
  361 + path.SetProperty( Path::Property::POINTS, points );
  362 +
  363 + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
  364 + controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
  365 + controlPoints[2] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
  366 + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
  367 + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
  368 +
  369 + forward = Vector3(-1.0f,0.0f,0.0f);
  370 + }
  371 + else if( mEffectMode == PageWaveEffect)
  372 + {
  373 + points[0] = Vector3( stageSize.x, 0.0f, -stageSize.x);
  374 + points[1] = Vector3( 0.0f, 0.0f, 0.0f );
  375 + points[2] = Vector3( -stageSize.x, 0.0f, -stageSize.x);
  376 + path.SetProperty( Path::Property::POINTS, points );
  377 +
  378 + controlPoints[0] = Vector3( 0.0f, 0.0f, -stageSize.x );
  379 + controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
  380 + controlPoints[2] = Vector3( -stageSize.x*0.5f, 0.0f, 0.0f);
  381 + controlPoints[3] = Vector3(0.0f, 0.0f,-stageSize.x );
  382 + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
  383 +
  384 + forward = Vector3(-1.0f,0.0f,0.0f);
  385 + }
  386 +
  387 + mScrollViewEffect = ScrollViewPagePathEffect::New(path, forward,Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(stageSize.x,stageSize.y,0.0f),PAGE_COLUMNS);
  388 + mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION);
  389 + mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION);
  390 + mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT);
  391 + mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT);
  392 + mScrollView.RemoveConstraintsFromChildren();
  393 +
  394 + rulerX = CreateRuler(snap ? stageSize.width * 0.5f : 0.0f);
  395 + if( wrap )
  396 + {
  397 + rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * 0.5f * PAGE_COLUMNS, !wrap));
  398 + }
  399 + else
  400 + {
  401 + rulerX->SetDomain(RulerDomain(0.0f, stageSize.x*0.5f* (PAGE_COLUMNS+1), !wrap));
477 402 }
478 403  
479 404 unsigned int currentPage = mScrollView.GetCurrentPage();
... ... @@ -518,94 +443,11 @@ private:
518 443 page.RemoveConstraints();
519 444 page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
520 445  
521   - switch( mEffectMode )
522   - {
523   - case PageCarouselEffect:
524   - case PageCubeEffect:
525   - case PageSpiralEffect:
526   - case PageWaveEffect:
527   - {
528   - ScrollViewPagePathEffect effect = ScrollViewPagePathEffect::DownCast( mScrollViewEffect );
529   - effect.ApplyToPage( page, pageOrder );
530   - break;
531   - }
532   -
533   - default:
534   - {
535   - break;
536   - }
537   - }
  446 + ScrollViewPagePathEffect effect = ScrollViewPagePathEffect::DownCast( mScrollViewEffect );
  447 + effect.ApplyToPage( page, pageOrder );
538 448 }
539 449  
540 450 /**
541   - * [Actor]
542   - * Applies effect to child which resides in page (which in turn resides in scrollview)
543   - *
544   - * @note Page is typically the Parent of child, although in
545   - * some scenarios Page is simply a container which has a child as
546   - * a descendent.
547   - *
548   - * @param[in] child The child actor to apply effect to
549   - * @param[in] page The page which this child is inside
550   - */
551   - void ApplyEffectToActor( Actor child, Actor page )
552   - {
553   - switch( mEffectMode )
554   - {
555   - case DepthEffect:
556   - {
557   - ApplyDepthEffectToActor( child );
558   - break;
559   - }
560   -
561   - case CubeEffect:
562   - {
563   - ApplyCubeEffectToActor( child );
564   - break;
565   - }
566   -
567   - default:
568   - {
569   - break;
570   - }
571   - }
572   - }
573   -
574   - /**
575   - * Applies depth effect to the child which resides in page (which in turn resides in scrollview)
576   - *
577   - * @param[in] child The child actor to apply depth effect to
578   - */
579   - void ApplyDepthEffectToActor( Actor child )
580   - {
581   - ScrollViewDepthEffect depthEffect = ScrollViewDepthEffect::DownCast(mScrollViewEffect);
582   - depthEffect.ApplyToActor( child,
583   - POSITION_EXTENT_DEPTH_EFFECT,
584   - OFFSET_EXTENT_DEPTH_EFFECT,
585   - POSITION_SCALE_DEPTH_EFFECT,
586   - SCALE_EXTENT_DEPTH_EFFECT );
587   - }
588   -
589   - void ApplyCubeEffectToActor( Actor child )
590   - {
591   - Vector3 anchor;
592   - if(rand()&1)
593   - {
594   - anchor = ANCHOR_3DEFFECT_STYLE0;
595   - }
596   - else
597   - {
598   - anchor = ANCHOR_3DEFFECT_STYLE1;
599   - }
600   -
601   - ScrollViewCubeEffect cubeEffect = ScrollViewCubeEffect::DownCast(mScrollViewEffect);
602   - cubeEffect.ApplyToActor( child,
603   - anchor,
604   - ANGLE_SWING_3DEFFECT,
605   - POSITION_SWING_3DEFFECT * Vector2(Stage::GetCurrent().GetSize()));
606   - }
607   -
608   - /**
609 451 * Creates an Image (Helper)
610 452 *
611 453 * @param[in] filename the path of the image.
... ... @@ -726,8 +568,6 @@ private:
726 568 */
727 569 enum EffectMode
728 570 {
729   - DepthEffect, ///< Depth Effect
730   - CubeEffect, ///< Cube effect
731 571 PageCarouselEffect, ///< Page carousel effect
732 572 PageCubeEffect, ///< Page cube effect
733 573 PageSpiralEffect, ///< Page spiral effect
... ...