1 /* 2 * Copyright (c) 2021-2022 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_PROPERTIES_MOTION_PATH_OPTION_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_PROPERTIES_MOTION_PATH_OPTION_H 18 19 #include <memory> 20 #include <string> 21 22 namespace OHOS::Ace { 23 24 class MotionPathOption final { 25 public: 26 MotionPathOption(const std::string& path = "", float begin = 0.0f, float end = 1.0f, bool rotate = false) 27 : path_(path), begin_(begin), end_(end), rotate_(rotate) 28 {} 29 ~MotionPathOption() = default; 30 SetPath(const std::string & path)31 void SetPath(const std::string& path) 32 { 33 path_ = path; 34 } GetPath()35 const std::string& GetPath() const 36 { 37 return path_; 38 } 39 SetBegin(float value)40 void SetBegin(float value) 41 { 42 begin_ = value; 43 } 44 GetBegin()45 float GetBegin() const 46 { 47 return begin_; 48 } 49 SetEnd(float value)50 void SetEnd(float value) 51 { 52 end_ = value; 53 } 54 GetEnd()55 float GetEnd() const 56 { 57 return end_; 58 } 59 SetRotate(bool value)60 void SetRotate(bool value) 61 { 62 rotate_ = value; 63 } 64 GetRotate()65 bool GetRotate() const 66 { 67 return rotate_; 68 } 69 IsValid()70 bool IsValid() const 71 { 72 return !path_.empty(); 73 } 74 75 bool operator==(const MotionPathOption& other) const 76 { 77 return (path_ == other.path_ && 78 begin_ == other.begin_ && 79 end_ == other.end_ && 80 rotate_ == other.rotate_); 81 } 82 83 private: 84 std::string path_; 85 float begin_ = 0.0f; 86 float end_ = 1.0f; 87 bool rotate_ = false; 88 }; 89 90 } // namespace OHOS::Ace 91 92 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_PROPERTIES_MOTION_PATH_OPTION_H 93