• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_PROPERTY_ANIMATION_H
17 #define RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_PROPERTY_ANIMATION_H
18 
19 #include <memory>
20 
21 #include "animation/rs_animation.h"
22 #include "common/rs_macros.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 class RSPropertyBase;
27 
28 class RSC_EXPORT RSPropertyAnimation : public RSAnimation {
29 public:
30     RSPropertyAnimation() = delete;
31     virtual ~RSPropertyAnimation() = default;
32 
33     void SetIsCustom(const bool isCustom);
34 
35     void DumpAnimationInfo(std::string& dumpInfo) const override;
36 
37 protected:
38     RSPropertyAnimation(std::shared_ptr<RSPropertyBase> property);
39 
40     void SetAdditive(bool isAdditive);
41 
42     bool GetAdditive() const;
43 
44     const std::shared_ptr<RSPropertyBase> GetOriginValue() const;
45 
46     void SetPropertyValue(const std::shared_ptr<RSPropertyBase>& value);
47 
48     const std::shared_ptr<RSPropertyBase> GetPropertyValue() const;
49 
50     PropertyId GetPropertyId() const override;
51 
52     void OnStart() override;
53 
54     void SetOriginValue(const std::shared_ptr<RSPropertyBase>& originValue);
55 
56     virtual void InitInterpolationValue();
57 
58     void OnUpdateStagingValue(bool isFirstStart) override;
59 
60     void UpdateStagingValueOnInteractiveFinish(RSInteractiveAnimationPosition pos) override;
61 
62     void SetPropertyOnAllAnimationFinish() override;
63 
64     std::shared_ptr<RSPropertyBase> property_;
65     std::shared_ptr<RSPropertyBase> byValue_ {};
66     std::shared_ptr<RSPropertyBase> startValue_ {};
67     std::shared_ptr<RSPropertyBase> endValue_ {};
68     std::shared_ptr<RSPropertyBase> originValue_ {};
69     bool isAdditive_ { true };
70     bool isCustom_ { false };
71     bool isDelta_ { false };
72     bool hasOriginValue_ { false };
73 
74 private:
75     void InitAdditiveMode();
76 };
77 } // namespace Rosen
78 } // namespace OHOS
79 
80 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_PROPERTY_ANIMATION_H
81