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_RENDER_TRANSITION_H 17 #define RENDER_SERVICE_CLIENT_CORE_TRANSITION_RS_RENDER_TRANSITION_H 18 19 #include "animation/rs_interpolator.h" 20 #include "animation/rs_render_animation.h" 21 #include "animation/rs_render_transition_effect.h" 22 #include "common/rs_macros.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 class RSTransitionEffect; 27 28 class RSB_EXPORT RSRenderTransition : public RSRenderAnimation { 29 public: 30 RSRenderTransition(AnimationId id, const std::shared_ptr<const RSTransitionEffect>& effect, bool isTransitionIn); SetInterpolator(const std::shared_ptr<RSInterpolator> & interpolator)31 void SetInterpolator(const std::shared_ptr<RSInterpolator>& interpolator) 32 { 33 interpolator_ = interpolator; 34 } 35 bool Marshalling(Parcel& parcel) const override; 36 static RSRenderTransition* Unmarshalling(Parcel& parcel); 37 38 protected: 39 bool ParseParam(Parcel& parcel) override; 40 void OnAnimate(float fraction) override; 41 void OnAttach() override; 42 void OnDetach() override; 43 44 std::vector<std::shared_ptr<RSRenderTransitionEffect>> effects_; 45 std::shared_ptr<RSInterpolator> interpolator_ { RSInterpolator::DEFAULT }; 46 47 private: 48 RSRenderTransition() = default; 49 bool isTransitionIn_; 50 }; 51 } // namespace Rosen 52 } // namespace OHOS 53 54 #endif 55