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/LICENSE2.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_ANIMATION_RS_TRANSITION_EFFECT_H 17 #define RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_TRANSITION_EFFECT_H 18 19 #include <memory> 20 #include <vector> 21 22 #include "common/rs_macros.h" 23 #include "common/rs_vector3.h" 24 #include "common/rs_vector4.h" 25 26 namespace OHOS { 27 namespace Rosen { 28 class RSRenderTransitionEffect; 29 30 class RSB_EXPORT RSTransitionEffect final : public std::enable_shared_from_this<RSTransitionEffect> { 31 public: 32 static const std::shared_ptr<const RSTransitionEffect> OPACITY; 33 34 static const std::shared_ptr<const RSTransitionEffect> SCALE; 35 36 static const std::shared_ptr<const RSTransitionEffect> EMPTY; 37 38 static std::shared_ptr<RSTransitionEffect> Create(); 39 40 static std::shared_ptr<RSTransitionEffect> Asymmetric(const std::shared_ptr<RSTransitionEffect>& transitionIn, 41 const std::shared_ptr<RSTransitionEffect>& transitionOut); 42 43 std::shared_ptr<RSTransitionEffect> Opacity(float opacity = 0.0f); 44 std::shared_ptr<RSTransitionEffect> Scale(const Vector3f& scale); 45 std::shared_ptr<RSTransitionEffect> Translate(const Vector3f& translate); 46 std::shared_ptr<RSTransitionEffect> Rotate(const Vector4f& axisAngle); 47 48 private: 49 RSTransitionEffect() = default; 50 51 RSTransitionEffect(const std::shared_ptr<RSTransitionEffect>& transitionIn, 52 const std::shared_ptr<RSTransitionEffect>& transitionOut); 53 54 const std::vector<std::shared_ptr<RSRenderTransitionEffect>>& GetTransitionInEffects() const; 55 const std::vector<std::shared_ptr<RSRenderTransitionEffect>>& GetTransitionOutEffects() const; 56 57 std::vector<std::shared_ptr<RSRenderTransitionEffect>> transitionInEffects_; 58 std::vector<std::shared_ptr<RSRenderTransitionEffect>> transitionOutEffects_; 59 60 friend class RSRenderTransition; 61 }; 62 } // namespace Rosen 63 } // namespace OHOS 64 65 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_TRANSITION_EFFECT_H 66