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 RSB_EXPORT RSRenderTransition : public RSRenderAnimation { 27 public: 28 RSRenderTransition( 29 AnimationId id, const std::vector<std::shared_ptr<RSRenderTransitionEffect>>& effects, bool isTransitionIn); 30 31 void DumpAnimationType(std::string& out) const override; 32 SetInterpolator(const std::shared_ptr<RSInterpolator> & interpolator)33 void SetInterpolator(const std::shared_ptr<RSInterpolator>& interpolator) 34 { 35 interpolator_ = interpolator; 36 } 37 38 bool Marshalling(Parcel& parcel) const override; 39 [[nodiscard]] static RSRenderTransition* Unmarshalling(Parcel& parcel); 40 41 protected: 42 bool ParseParam(Parcel& parcel) override; 43 void OnAnimate(float fraction) override; 44 void OnAttach() override; 45 void OnDetach() override; 46 47 std::vector<std::shared_ptr<RSRenderTransitionEffect>> effects_; 48 std::shared_ptr<RSInterpolator> interpolator_ { RSInterpolator::DEFAULT }; 49 50 private: 51 RSRenderTransition() = default; 52 bool isTransitionIn_ { false }; 53 }; 54 } // namespace Rosen 55 } // namespace OHOS 56 57 #endif 58