1 /* 2 * Copyright (c) 2021 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_PICKER_TOSS_ANIMATION_CONTROLLER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_PICKER_TOSS_ANIMATION_CONTROLLER_H 18 19 #include "core/components/picker/picker_animation.h" 20 #include "core/pipeline/base/render_node.h" 21 namespace OHOS::Ace { 22 23 class TossAnimationController : public virtual AceType { 24 DECLARE_ACE_TYPE(TossAnimationController, AceType); 25 26 public: 27 TossAnimationController() = default; 28 ~TossAnimationController() = default; 29 SetColumn(const WeakPtr<RenderNode> & value)30 void SetColumn(const WeakPtr<RenderNode>& value) 31 { 32 column_ = value; 33 } 34 SetPipelineContext(const WeakPtr<PipelineContext> & value)35 void SetPipelineContext(const WeakPtr<PipelineContext>& value) 36 { 37 pipe_ = value; 38 } 39 40 void SetStart(double y); 41 42 void SetEnd(double y); 43 44 bool Play(); 45 46 private: 47 double GetCurrentTime() const; 48 49 double yStart_ = 0.0; 50 double yEnd_ = 0.0; 51 double timeStart_ = 0.0; 52 double timeEnd_ = 0.0; 53 double speed_ = 0.0; 54 55 RefPtr<PickerAnimation> toss_; 56 WeakPtr<RenderNode> column_; 57 WeakPtr<PipelineContext> pipe_; 58 }; 59 60 } // namespace OHOS::Ace 61 62 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_PICKER_TOSS_ANIMATION_CONTROLLER_H 63