• 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_TRANSITION_RS_TRANSITION_H
17 #define RENDER_SERVICE_CLIENT_CORE_TRANSITION_RS_TRANSITION_H
18 
19 #include "animation/rs_animation.h"
20 #include "animation/rs_animation_timing_curve.h"
21 #include "animation/rs_interpolator.h"
22 #include "animation/rs_transition_effect.h"
23 #include "platform/common/rs_log.h"
24 
25 namespace OHOS {
26 namespace Rosen {
27 
28 class RSC_EXPORT RSTransition : public RSAnimation {
29 public:
30     RSTransition(const std::shared_ptr<const RSTransitionEffect>& effect, bool isTransitionIn);
31     virtual ~RSTransition() = default;
32 
SetTransitionEffect(const std::shared_ptr<const RSTransitionEffect> & effect)33     void SetTransitionEffect(const std::shared_ptr<const RSTransitionEffect>& effect)
34     {
35         effect_ = effect;
36     }
37 
SetTimingCurve(const RSAnimationTimingCurve & timingCurve)38     void SetTimingCurve(const RSAnimationTimingCurve& timingCurve)
39     {
40         if (timingCurve.type_ != RSAnimationTimingCurve::CurveType::INTERPOLATING) {
41             ROSEN_LOGE("RSTransition::SetTimingCurve: invalid timing curve type");
42             return;
43         }
44         timingCurve_ = timingCurve;
45     }
46 
47 protected:
48     void OnStart() override;
49 
50 private:
51     bool isTransitionIn_;
52     std::shared_ptr<const RSTransitionEffect> effect_;
53     RSAnimationTimingCurve timingCurve_ { RSAnimationTimingCurve::DEFAULT };
54 };
55 } // namespace Rosen
56 } // namespace OHOS
57 
58 #endif
59