1 #ifndef DALI_DEMO_BUBBLE_ANIMATOR_H
\r
2 #define DALI_DEMO_BUBBLE_ANIMATOR_H
\r
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
21 // EXTERNAL INCLUDES
\r
22 #include <dali/public-api/actors/actor.h>
\r
23 #include <dali/public-api/adaptor-framework/timer.h>
\r
24 #include <dali/public-api/animation/animation.h>
\r
25 #include <dali/public-api/object/weak-handle.h>
\r
26 #include <dali/public-api/signals/connection-tracker.h>
\r
30 * Creates and animates random sized bubbles
\r
32 class BubbleAnimator : public Dali::ConnectionTracker
\r
36 * @brief Initilizes the bubble background
\r
38 * @param parent The actor to add all the bubbles to
\r
39 * @param scrollView If provided, does a parallax effect when scrolling using this scroll-view (optional)
\r
41 void Initialize(Dali::Actor parent, Dali::Actor scrollView = Dali::Actor());
\r
44 * @brief Plays the bubble animation
\r
46 void PlayAnimation();
\r
50 * @brief Used by the timer to pause the animation
\r
52 * @return Returns false to cancel the timer
\r
54 bool PauseAnimation();
\r
57 * @brief Initializes the background actors
\r
59 * @param actor Actor which contains all the children
\r
61 void InitializeBackgroundActors(Dali::Actor actor);
\r
64 * Create background actors for the given layer
\r
66 * @param[in] layer The layer to add the actors to
\r
67 * @param[in] count The number of actors to generate
\r
69 void AddBackgroundActors(Dali::Actor layer, int count);
\r
72 using AnimationList = std::vector<Dali::Animation>;
\r
74 Dali::WeakHandle<Dali::Actor> mScrollView; ///< Weak handle to the scroll view used to apply a parallax effect when scrolling.
\r
75 AnimationList mBackgroundAnimations; ///< List of background bubble animations.
\r
76 Dali::Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period.
\r
77 bool mBackgroundAnimsPlaying{false}; ///< Are background animations playing.
\r
80 #endif // DALI_DEMO_BUBBLE_ANIMATOR_H
\r