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