1 /* 2 * Copyright (c) 2021-2022 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 24 namespace OHOS { 25 namespace Rosen { 26 27 class RS_EXPORT RSTransition : public RSAnimation { 28 public: 29 RSTransition(const std::shared_ptr<const RSTransitionEffect>& effect, bool isTransitionIn); 30 virtual ~RSTransition() = default; 31 SetTransitionEffect(const std::shared_ptr<const RSTransitionEffect> & effect)32 void SetTransitionEffect(const std::shared_ptr<const RSTransitionEffect>& effect) 33 { 34 effect_ = effect; 35 } 36 SetTimingCurve(const RSAnimationTimingCurve & timingCurve)37 void SetTimingCurve(const RSAnimationTimingCurve& timingCurve) 38 { 39 timingCurve_ = timingCurve; 40 } 41 42 protected: 43 void OnStart() override; 44 45 private: 46 bool isTransitionIn_; 47 std::shared_ptr<const RSTransitionEffect> effect_; 48 RSAnimationTimingCurve timingCurve_ { RSAnimationTimingCurve::DEFAULT }; 49 }; 50 } // namespace Rosen 51 } // namespace OHOS 52 53 #endif 54