1 /* 2 * Copyright (c) 2024 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 #ifndef RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_INTERACTIVE_IMPLICT_ANIMATOR_H 16 #define RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_INTERACTIVE_IMPLICT_ANIMATOR_H 17 18 #include <refbase.h> 19 #include <vector> 20 21 #include "animation/rs_animation_common.h" 22 #include "common/rs_common_def.h" 23 #include "common/rs_macros.h" 24 25 namespace OHOS { 26 namespace Rosen { 27 class RSContext; 28 29 class RSB_EXPORT RSRenderInteractiveImplictAnimator : 30 public std::enable_shared_from_this<RSRenderInteractiveImplictAnimator> { 31 public: 32 explicit RSRenderInteractiveImplictAnimator 33 (InteractiveImplictAnimatorId id, const std::weak_ptr<RSContext>& context = {}); 34 ~RSRenderInteractiveImplictAnimator() = default; 35 36 void AddAnimations(std::vector<std::pair<NodeId, AnimationId>> animations); 37 void PauseAnimator(); 38 void ContinueAnimator(); 39 void FinishAnimator(RSInteractiveAnimationPosition finishPos); 40 void ReverseAnimator(); 41 void SetFractionAnimator(float fraction); 42 GetId()43 inline InteractiveImplictAnimatorId GetId() const 44 { 45 return id_; 46 } 47 private: 48 RSRenderInteractiveImplictAnimator() = default; 49 InteractiveImplictAnimatorId id_ = 0; 50 std::weak_ptr<RSContext> context_ = {}; 51 std::vector<std::pair<NodeId, AnimationId>> animations_ = {}; 52 53 friend class RSContext; 54 }; 55 } // namespace Rosen 56 } // namespace OHOS 57 58 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_INTERACTIVE_IMPLICT_ANIMATOR_H 59