Revert "[3.0] Remove bubble-effect from dali demo main screen" 10/97810/1
authordongsug.song <dongsug.song@samsung.com>
Tue, 15 Nov 2016 05:17:49 +0000 (14:17 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Tue, 15 Nov 2016 05:17:51 +0000 (14:17 +0900)
This reverts commit 29d0fc514b6296cf070f187fda8ff5af92158661.

Change-Id: I69bf23d58208a24884c5276664dd16b130302f3e

demo/dali-table-view.cpp
demo/dali-table-view.h

index 6d23833..daebe61 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -44,7 +44,6 @@ const std::string TILE_BACKGROUND_ALPHA(DEMO_IMAGE_DIR "item-background-alpha.9.
 
 const char * const DEFAULT_TOOLBAR_TEXT( "TOUCH TO LAUNCH EXAMPLE" );
 
-const Vector4 TILE_COLOR( 0.5f, 0.6f, 0.8f, 0.23f );            ///< Color (including alpha) of tile contents.
 const float BUTTON_PRESS_ANIMATION_TIME = 0.25f;                ///< Time to perform button scale effect.
 const float ROTATE_ANIMATION_TIME = 0.5f;                       ///< Time to perform rotate effect.
 const int MAX_PAGES = 256;                                      ///< Maximum pages (arbitrary safety limit)
@@ -55,6 +54,34 @@ const float LOGO_MARGIN_RATIO = 0.1f / 0.3f;
 const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f;
 const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f );     ///< ScrollView's relative size to its parent
 const Vector3 TABLE_RELATIVE_SIZE(0.95f, 0.9f, 0.8f );          ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights.
+const float STENCIL_RELATIVE_SIZE = 1.0f;
+
+const float EFFECT_SNAP_DURATION = 0.66f;                       ///< Scroll Snap Duration for Effects
+const float EFFECT_FLICK_DURATION = 0.5f;                       ///< Scroll Flick Duration for Effects
+const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f);
+
+const Vector4 BUBBLE_COLOR[] =
+{
+  Vector4( 0.3255f, 0.3412f, 0.6353f, 0.38f ),
+  Vector4( 0.3647f, 0.7569f, 0.8157f, 0.38f ),
+  Vector4( 0.3804f, 0.7412f, 0.6510f, 0.38f ),
+  Vector4( 1.f, 1.f, 1.f, 0.2f )
+};
+const int NUMBER_OF_BUBBLE_COLOR( sizeof(BUBBLE_COLOR) / sizeof(BUBBLE_COLOR[0]) );
+
+const int NUM_BACKGROUND_IMAGES = 18;
+const float BACKGROUND_SWIPE_SCALE = 0.025f;
+const float BACKGROUND_SPREAD_SCALE = 1.5f;
+const float SCALE_MOD = 1000.0f * Math::PI * 2.0f;
+const float SCALE_SPEED = 10.0f;
+const float SCALE_SPEED_SIN = 0.1f;
+
+const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs
+
+const Vector4 BACKGROUND_COLOR( 0.3569f, 0.5451f, 0.7294f, 1.0f );
+
+const float BUBBLE_MIN_Z = -1.0;
+const float BUBBLE_MAX_Z = 0.0f;
 
 /**
  * Creates the background image
@@ -72,6 +99,38 @@ Control CreateBackground( std::string stylename )
   return background;
 }
 
+/**
+ * Constraint to return a position for a bubble based on the scroll value and vertical wrapping
+ */
+struct AnimateBubbleConstraint
+{
+public:
+  AnimateBubbleConstraint( const Vector3& initialPos, float scale )
+  : mInitialX( initialPos.x ),
+    mScale( scale )
+  {
+  }
+
+  void operator()( Vector3& position, const PropertyInputContainer& inputs )
+  {
+    const Vector3& parentSize = inputs[1]->GetVector3();
+    const Vector3& childSize = inputs[2]->GetVector3();
+
+    // Wrap bubbles vertically.
+    float range = parentSize.y + childSize.y;
+    // This performs a float mod (we don't use fmod as we want the arithmetic modulus as opposed to the remainder).
+    position.y -= range * ( floor( position.y / range ) + 0.5f );
+
+    // Bubbles X position moves parallax to horizontal
+    // panning by a scale factor unique to each bubble.
+    position.x = mInitialX + ( inputs[0]->GetVector2().x * mScale );
+  }
+
+private:
+  float mInitialX;
+  float mScale;
+};
+
 bool CompareByTitle( const Example& lhs, const Example& rhs )
 {
   return lhs.title < rhs.title;
@@ -91,13 +150,16 @@ DaliTableView::DaliTableView( Application& application )
   mScrollRulerX(),
   mScrollRulerY(),
   mPressedActor(),
+  mAnimationTimer(),
   mLogoTapDetector(),
   mVersionPopup(),
   mPages(),
+  mBackgroundAnimations(),
   mExampleList(),
   mTotalPages(),
   mScrolling( false ),
-  mSortAlphabetically( false )
+  mSortAlphabetically( false ),
+  mBackgroundAnimsPlaying( false )
 {
   application.InitSignal().Connect( this, &DaliTableView::Initialize );
 }
@@ -189,6 +251,25 @@ void DaliTableView::Initialize( Application& application )
   mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER );
   mScrollViewLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
+  // Create solid background colour.
+  Control backgroundColourActor = Control::New();
+  backgroundColourActor.SetBackgroundColor( BACKGROUND_COLOR );
+  backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER );
+  backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER );
+  backgroundColourActor.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
+  backgroundColourActor.SetSizeModeFactor( Vector3( 1.0f, 1.5f, 1.0f ) );
+
+  mScrollViewLayer.Add( backgroundColourActor );
+
+  // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show
+  Actor bubbleContainer = Actor::New();
+  bubbleContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+  bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER );
+  bubbleContainer.SetParentOrigin( ParentOrigin::CENTER );
+  backgroundColourActor.Add( bubbleContainer );
+
+  SetupBackground( bubbleContainer );
+
   Alignment buttonsAlignment = Alignment::New();
   buttonsAlignment.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   buttonsAlignment.Add( mScrollViewLayer );
@@ -220,6 +301,12 @@ void DaliTableView::Initialize( Application& application )
 
   winHandle.ShowIndicator( Dali::Window::INVISIBLE );
 
+  // Background animation
+  mAnimationTimer = Timer::New( BACKGROUND_ANIMATION_DURATION );
+  mAnimationTimer.TickSignal().Connect( this, &DaliTableView::PauseBackgroundAnimation );
+  mAnimationTimer.Start();
+  mBackgroundAnimsPlaying = true;
+
   KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &DaliTableView::OnKeyboardPreFocusChange );
   KeyboardFocusManager::Get().FocusedActorEnterKeySignal().Connect( this, &DaliTableView::OnFocusedActorActivated );
   AccessibilityManager::Get().FocusedActorActivatedSignal().Connect( this, &DaliTableView::OnFocusedActorActivated );
@@ -238,6 +325,7 @@ void DaliTableView::ApplyCubeEffectToPages()
 
 void DaliTableView::OnButtonsPageRelayout( const Dali::Actor& actor )
 {
+
 }
 
 void DaliTableView::Populate()
@@ -276,7 +364,7 @@ void DaliTableView::Populate()
         {
           const Example& example = ( *iter );
 
-          Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), TILE_COLOR );
+          Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), true );
           AccessibilityManager accessibilityManager = AccessibilityManager::Get();
           accessibilityManager.SetFocusOrder( tile, ++exampleCount );
           accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_LABEL,
@@ -348,7 +436,7 @@ void DaliTableView::Rotate( unsigned int degrees )
   mRotateAnimation.Play();
 }
 
-Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, const Dali::Vector4& color )
+Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground )
 {
   Actor content = Actor::New();
   content.SetName( name );
@@ -357,25 +445,23 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit
   content.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
   content.SetSizeModeFactor( sizeMultiplier );
 
-  // Create background image.
-  ImageView image = ImageView::New( TILE_BACKGROUND );
-  image.SetAnchorPoint( AnchorPoint::CENTER );
-  image.SetParentOrigin( ParentOrigin::CENTER );
-  // Make the image 100% of tile.
-  image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-  content.Add( image );
-
-  // Create the tile background.
-  Actor tileBackground = ImageView::New( TILE_BACKGROUND_ALPHA );
-  tileBackground.SetParentOrigin( ParentOrigin::CENTER );
-  tileBackground.SetAnchorPoint( AnchorPoint::CENTER );
-  tileBackground.SetProperty( Actor::Property::COLOR, color );
-  Property::Map shaderEffect = CreateAlphaDiscardEffect();
-  tileBackground.SetProperty( Toolkit::ImageView::Property::IMAGE, shaderEffect );
-  tileBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-  image.Add( tileBackground );
+  // create background image
+  if( addBackground )
+  {
+    ImageView image = ImageView::New( TILE_BACKGROUND );
+    image.SetAnchorPoint( AnchorPoint::CENTER );
+    image.SetParentOrigin( ParentOrigin::CENTER );
+    // make the image 100% of tile
+    image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
+    content.Add( image );
+
+    // Add stencil
+    Toolkit::ImageView stencil = NewStencilImage();
+    stencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+    image.Add( stencil );
+  }
 
-  // Create the tile label.
   TextLabel label = TextLabel::New();
   label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
   label.SetProperty( Control::Property::STYLE_NAME, "launcherlabel" );
@@ -396,6 +482,19 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit
   return content;
 }
 
+Toolkit::ImageView DaliTableView::NewStencilImage()
+{
+  Toolkit::ImageView stencil = ImageView::New( TILE_BACKGROUND_ALPHA );
+  stencil.SetParentOrigin( ParentOrigin::CENTER );
+  stencil.SetAnchorPoint( AnchorPoint::CENTER );
+  stencil.SetDrawMode( DrawMode::STENCIL );
+
+  Property::Map shaderEffect = CreateAlphaDiscardEffect();
+  stencil.SetProperty( Toolkit::ImageView::Property::IMAGE, shaderEffect );
+
+  return stencil;
+}
+
 bool DaliTableView::OnTilePressed( Actor actor, const TouchData& event )
 {
   return DoTilePress( actor, event.GetState( 0 ) );
@@ -472,6 +571,8 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source )
 void DaliTableView::OnScrollStart( const Dali::Vector2& position )
 {
   mScrolling = true;
+
+  PlayAnimation();
 }
 
 void DaliTableView::OnScrollComplete( const Dali::Vector2& position )
@@ -555,6 +656,138 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event )
   }
 }
 
+void DaliTableView::SetupBackground( Actor bubbleContainer )
+{
+  // Create distance field shape.
+  BufferImage distanceField;
+  Size imageSize( 512, 512 );
+  CreateShapeImage( CIRCLE, imageSize, distanceField );
+
+  // Add bubbles to the bubbleContainer.
+  // Note: The bubbleContainer is parented externally to this function.
+  AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField );
+}
+
+void DaliTableView::InitialiseBackgroundActors( Actor actor )
+{
+  // Delete current animations
+  mBackgroundAnimations.clear();
+
+  // Create new animations
+  const Vector3 size = actor.GetTargetSize();
+
+  for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i )
+  {
+    Actor child = actor.GetChildAt( i );
+
+    // Calculate a random position
+    Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ),
+                      Random::Range( -size.y, size.y ),
+                      Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) );
+
+    child.SetPosition( childPos );
+
+    // Define bubble horizontal parallax and vertical wrapping
+    Constraint animConstraint = Constraint::New < Vector3 > ( child, Actor::Property::POSITION, AnimateBubbleConstraint( childPos, Random::Range( -0.85f, 0.25f ) ) );
+    animConstraint.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) );
+    animConstraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) );
+    animConstraint.AddSource( Dali::LocalSource( Dali::Actor::Property::SIZE ) );
+    animConstraint.SetRemoveAction( Constraint::Discard );
+    animConstraint.Apply();
+
+    // Kickoff animation
+    Animation animation = Animation::New( Random::Range( 30.0f, 160.0f ) );
+    animation.AnimateBy( Property( child, Actor::Property::POSITION ), Vector3( 0.0f, -2000.0f, 0.0f ), AlphaFunction::LINEAR );
+    animation.SetLooping( true );
+    animation.Play();
+    mBackgroundAnimations.push_back( animation );
+  }
+}
+
+void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField )
+{
+  for( int i = 0; i < count; ++i )
+  {
+    float randSize = Random::Range( 10.0f, 400.0f );
+    ImageView dfActor = ImageView::New( distanceField );
+    dfActor.SetSize( Vector2( randSize, randSize ) );
+    dfActor.SetParentOrigin( ParentOrigin::CENTER );
+
+    Dali::Property::Map effect = Toolkit::CreateDistanceFieldEffect();
+    dfActor.SetProperty( Toolkit::ImageView::Property::IMAGE, effect );
+    dfActor.SetColor( BUBBLE_COLOR[ i%NUMBER_OF_BUBBLE_COLOR ] );
+
+    layer.Add( dfActor );
+  }
+
+  // Positioning will occur when the layer is relaid out
+  layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors );
+}
+
+void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut )
+{
+  // this bitmap will hold the alpha map for the distance field shader
+  distanceFieldOut = BufferImage::New( size.width, size.height, Pixel::A8 );
+
+  // Generate bit pattern
+  std::vector< unsigned char > imageDataA8;
+  imageDataA8.reserve( size.width * size.height ); // A8
+
+  switch( shapeType )
+  {
+    case CIRCLE:
+      GenerateCircle( size, imageDataA8 );
+      break;
+    case SQUARE:
+      GenerateSquare( size, imageDataA8 );
+      break;
+    default:
+      break;
+  }
+
+  PixelBuffer* buffer = distanceFieldOut.GetBuffer();
+  if( buffer )
+  {
+    GenerateDistanceFieldMap( &imageDataA8[ 0 ], size, buffer, size, 8.0f, size );
+    distanceFieldOut.Update();
+  }
+}
+
+void DaliTableView::GenerateSquare( const Size& size, std::vector< unsigned char >& distanceFieldOut )
+{
+  for( int h = 0; h < size.height; ++h )
+  {
+    for( int w = 0; w < size.width; ++w )
+    {
+      distanceFieldOut.push_back( 0xFF );
+    }
+  }
+}
+
+void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char >& distanceFieldOut )
+{
+  const float radius = size.width * 0.5f * size.width * 0.5f;
+  Vector2 center( size.width / 2, size.height / 2 );
+
+  for( int h = 0; h < size.height; ++h )
+  {
+    for( int w = 0; w < size.width; ++w )
+    {
+      Vector2 pos( w, h );
+      Vector2 dist = pos - center;
+
+      if( dist.x * dist.x + dist.y * dist.y > radius )
+      {
+        distanceFieldOut.push_back( 0x00 );
+      }
+      else
+      {
+        distanceFieldOut.push_back( 0xFF );
+      }
+    }
+  }
+}
+
 ImageView DaliTableView::CreateLogo( std::string imagePath )
 {
   ImageView logo = ImageView::New( imagePath );
@@ -565,6 +798,45 @@ ImageView DaliTableView::CreateLogo( std::string imagePath )
   return logo;
 }
 
+bool DaliTableView::PauseBackgroundAnimation()
+{
+  PauseAnimation();
+
+  return false;
+}
+
+void DaliTableView::PauseAnimation()
+{
+  if( mBackgroundAnimsPlaying )
+  {
+    for( AnimationListIter animIter = mBackgroundAnimations.begin(); animIter != mBackgroundAnimations.end(); ++animIter )
+    {
+      Animation anim = *animIter;
+
+      anim.Stop();
+    }
+
+    mBackgroundAnimsPlaying = false;
+  }
+}
+
+void DaliTableView::PlayAnimation()
+{
+  if ( !mBackgroundAnimsPlaying )
+  {
+    for( AnimationListIter animIter = mBackgroundAnimations.begin(); animIter != mBackgroundAnimations.end(); ++animIter )
+    {
+      Animation anim = *animIter;
+
+      anim.Play();
+    }
+
+    mBackgroundAnimsPlaying = true;
+  }
+
+  mAnimationTimer.SetInterval( BACKGROUND_ANIMATION_DURATION );
+}
+
 Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction )
 {
   Actor nextFocusActor = proposed;
@@ -658,13 +930,11 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap
       Toolkit::TextLabel titleActor = Toolkit::TextLabel::New( "Version information" );
       titleActor.SetName( "titleActor" );
       titleActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
-      titleActor.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
 
       Toolkit::TextLabel contentActor = Toolkit::TextLabel::New( stream.str() );
       contentActor.SetName( "contentActor" );
       contentActor.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
       contentActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
-      contentActor.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
       contentActor.SetPadding( Padding( 0.0f, 0.0f, 20.0f, 0.0f ) );
 
       mVersionPopup.SetTitle( titleActor );
index c712a5b..749000b 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_DEMO_H
-#define DALI_DEMO_H
+#ifndef __DALI_DEMO_H__
+#define __DALI_DEMO_H__
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -98,6 +98,15 @@ public:
 private: // Application callbacks & implementation
 
   /**
+   * Shape enum for create function
+   */
+  enum ShapeType
+  {
+    CIRCLE,
+    SQUARE
+  };
+
+  /**
    * Initialize application.
    *
    * @param[in] app Application instance
@@ -131,11 +140,18 @@ private: // Application callbacks & implementation
    * @param[in] name The unique name for this Tile
    * @param[in] title The text caption that appears on the Tile
    * @param[in] parentSize Tile's parent size.
-   * @param[in] color The color (including alpha) of the tiles contents.
+   * @param[in] addBackground Whether to add a background graphic to the tile or not
    *
    * @return The Actor for the created tile.
    */
-  Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, const Dali::Vector4& color );
+  Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground );
+
+  /**
+   * Create a stencil image
+   *
+   * @return The stencil image
+   */
+  Dali::Toolkit::ImageView NewStencilImage();
 
   // Signal handlers
 
@@ -241,6 +257,49 @@ private: // Application callbacks & implementation
   void OnKeyEvent( const Dali::KeyEvent& event );
 
   /**
+   * Create a depth field background
+   *
+   * @param[in] bubbleLayer Add the graphics to this layer
+   */
+  void SetupBackground( Dali::Actor bubbleLayer );
+
+  /**
+   * Create background actors for the given layer
+   *
+   * @param[in] layer The layer to add the actors to
+   * @param[in] count The number of actors to generate
+   * @param[in] distanceField The distance field bitmap to use
+   */
+  void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage distanceField );
+
+  /**
+   * Create a bitmap with the specified shape and also output a distance field
+   *
+   * @param[in] shapeType The shape to generate
+   * @param[in] size The size of the bitmap to create
+   * @param[out] distanceFieldOut The return depth field alpha map
+   */
+  void CreateShapeImage( ShapeType shapeType, const Dali::Size& size, Dali::BufferImage& distanceFieldOut );
+
+  /**
+   * Generate a square bit pattern and depth field
+   *
+   * @param[in] size The size of the bitmap to create
+   * @param[out] imageOut The return bitmap
+   * @param[out] distanceFieldOut The return depth field alpha map
+   */
+  void GenerateSquare( const Dali::Size& size, std::vector<unsigned char>& distanceFieldOut );
+
+  /**
+   * Generate a circle bit pattern and depth field
+   *
+   * @param[in] size The size of the bitmap to create
+   * @param[out] imageOut The return bitmap
+   * @param[out] distanceFieldOut The return depth field alpha map
+   */
+  void GenerateCircle( const Dali::Size& size, std::vector<unsigned char>& distanceFieldOut );
+
+  /**
    * Creates the logo.
    *
    * @param[in] imagePath The path to the image file to load
@@ -250,6 +309,23 @@ private: // Application callbacks & implementation
   Dali::Toolkit::ImageView CreateLogo( std::string imagePath );
 
   /**
+   * Timer handler for ending background animation
+   *
+   * @return Return value for timer handler
+   */
+  bool PauseBackgroundAnimation();
+
+  /**
+   * Pause all animations
+   */
+  void PauseAnimation();
+
+  /**
+   * Resume all animations
+   */
+  void PlayAnimation();
+
+  /**
    * Callback when the keyboard focus is going to be changed.
    *
    * @param[in] current The current focused actor
@@ -286,6 +362,13 @@ private: // Application callbacks & implementation
   */
  void OnButtonsPageRelayout( const Dali::Actor& actor );
 
+ /**
+  * @brief Callback called to set up background actors
+  *
+  * @param[in] actor The actor raising the callback
+  */
+ void InitialiseBackgroundActors( Dali::Actor actor );
+
 private:
 
   Dali::Application&              mApplication;              ///< Application instance.
@@ -299,17 +382,20 @@ private:
   Dali::Toolkit::RulerPtr         mScrollRulerX;             ///< ScrollView X (horizontal) ruler
   Dali::Toolkit::RulerPtr         mScrollRulerY;             ///< ScrollView Y (vertical) ruler
   Dali::Actor                     mPressedActor;             ///< The currently pressed actor.
+  Dali::Timer                     mAnimationTimer;           ///< Timer used to turn off animation after a specific time period
   Dali::TapGestureDetector        mLogoTapDetector;          ///< To detect taps on the logo
   Dali::Toolkit::Popup            mVersionPopup;             ///< Displays DALi library version information
 
   std::vector< Dali::Actor >      mPages;                    ///< List of pages.
+  AnimationList                   mBackgroundAnimations;     ///< List of background bubble animations
   ExampleList                     mExampleList;              ///< List of examples.
 
   int                             mTotalPages;               ///< Total pages within scrollview.
 
   bool                            mScrolling:1;              ///< Flag indicating whether view is currently being scrolled
   bool                            mSortAlphabetically:1;     ///< Sort examples alphabetically.
+  bool                            mBackgroundAnimsPlaying:1; ///< Are background animations playing
 
 };
 
-#endif // DALI_DEMO_H
+#endif // __DALI_DEMO_H__