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 16 #ifndef META_INTERFACE_ICURVE_1D_H 17 #define META_INTERFACE_ICURVE_1D_H 18 19 #include <meta/base/namespace.h> 20 #include <meta/interface/curves/intf_curve.h> 21 22 META_BEGIN_NAMESPACE() 23 24 META_REGISTER_INTERFACE(ICurve1D, "3752a2b4-0972-4af3-a20d-7832ed60c65f") 25 26 /** 27 * @brief ICurve1D is the base interface for all 1D curves which transform 28 * a one-dimensional curve along an axis. 29 * 30 * A specialization of ICurve1D is IEasingCurve, which adds the requirement 31 * that the easing curve starts at 0 and ends at 1. 32 */ 33 class ICurve1D : public ICurve<float> { 34 META_INTERFACE(ICurve<float>, ICurve1D) 35 public: 36 /** 37 * @brief The transformation function for this curve. 38 * @param t The point along the curve where the transformation should happen. 39 * @return Transformed value. 40 */ 41 float Transform(float t) const override = 0; 42 }; 43 44 META_END_NAMESPACE() 45 46 META_TYPE(META_NS::ICurve1D::WeakPtr) 47 META_TYPE(META_NS::ICurve1D::Ptr) 48 49 #endif 50