1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef META_SRC_ANIMATION_SEQUENTIAL_ANIMATION_H
17#define META_SRC_ANIMATION_SEQUENTIAL_ANIMATION_H
18
19#include "animation.h"
20#include "staggered_animation_state.h"
21
22META_BEGIN_NAMESPACE()
23
24namespace Internal {
25
26class SequentialAnimation final : public BaseAnimationContainerFwd<SequentialAnimation,
27                                      META_NS::ClassId::SequentialAnimation, ISequentialAnimation> {
28    using Super =
29        BaseAnimationContainerFwd<SequentialAnimation, META_NS::ClassId::SequentialAnimation, ISequentialAnimation>;
30
31public:
32    SequentialAnimation() = default;
33    ~SequentialAnimation() override = default;
34
35    bool Build(const IMetadata::Ptr& data) override;
36
37private:
38    AnimationState::AnimationStateParams GetParams() override;
39    void Evaluate() override;
40    void ChildrenChanged();
41
42    IContainer& GetContainer() noexcept override
43    {
44        return state_.GetContainerInterface();
45    }
46    const IContainer& GetContainer() const noexcept override
47    {
48        return state_.GetContainerInterface();
49    }
50    Internal::SequentialAnimationState& GetState() noexcept override
51    {
52        return state_;
53    }
54    Internal::SequentialAnimationState state_;
55};
56
57} // namespace Internal
58
59META_END_NAMESPACE()
60
61#endif // META_SRC_ANIMATION_SEQUENTIAL_ANIMATION_H
62