Commit 9fa77330c91b704e207533ba96f1f30fc459f51d

Authored by Tom Robinson
1 parent 6f348bec

Fixed dali-demo bubbles non-linear movement and stopping

Change-Id: I6788eb41a29a81f9a2f3fb1722d9ef5e416075b8
Showing 1 changed file with 7 additions and 7 deletions
demo/dali-table-view.cpp
@@ -116,11 +116,10 @@ public: @@ -116,11 +116,10 @@ public:
116 const Vector3& parentSize = inputs[1]->GetVector3(); 116 const Vector3& parentSize = inputs[1]->GetVector3();
117 const Vector3& childSize = inputs[2]->GetVector3(); 117 const Vector3& childSize = inputs[2]->GetVector3();
118 118
119 - // Wrap bubbles verically.  
120 - if( position.y + childSize.y * 0.5f < -parentSize.y * 0.5f )  
121 - {  
122 - position.y = parentSize.y * 0.5f + childSize.y * 0.5f;  
123 - } 119 + // Wrap bubbles vertically.
  120 + float range = parentSize.y + childSize.y;
  121 + // This performs a float mod (we don't use fmod as we want the arithmetic modulus as opposed to the remainder).
  122 + position.y -= range * ( floor( position.y / range ) + 0.5f );
124 123
125 // Bubbles X position moves parallax to horizontal 124 // Bubbles X position moves parallax to horizontal
126 // panning by a scale factor unique to each bubble. 125 // panning by a scale factor unique to each bubble.
@@ -698,11 +697,12 @@ void DaliTableView::InitialiseBackgroundActors( Actor actor ) @@ -698,11 +697,12 @@ void DaliTableView::InitialiseBackgroundActors( Actor actor )
698 animConstraint.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) ); 697 animConstraint.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) );
699 animConstraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) ); 698 animConstraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) );
700 animConstraint.AddSource( Dali::LocalSource( Dali::Actor::Property::SIZE ) ); 699 animConstraint.AddSource( Dali::LocalSource( Dali::Actor::Property::SIZE ) );
  700 + animConstraint.SetRemoveAction( Constraint::Discard );
701 animConstraint.Apply(); 701 animConstraint.Apply();
702 702
703 // Kickoff animation 703 // Kickoff animation
704 - Animation animation = Animation::New( Random::Range( 40.0f, 80.0f ) );  
705 - animation.AnimateBy( Property( child, Actor::Property::POSITION ), Vector3( 0.0f, -1.0f, 0.0f ), AlphaFunction::LINEAR ); 704 + Animation animation = Animation::New( Random::Range( 30.0f, 160.0f ) );
  705 + animation.AnimateBy( Property( child, Actor::Property::POSITION ), Vector3( 0.0f, -2000.0f, 0.0f ), AlphaFunction::LINEAR );
706 animation.SetLooping( true ); 706 animation.SetLooping( true );
707 animation.Play(); 707 animation.Play();
708 mBackgroundAnimations.push_back( animation ); 708 mBackgroundAnimations.push_back( animation );