2 #include <Curve/Segment/CurveSegmentFactory.hpp>
3 #include <Curve/Segment/CurveSegmentModel.hpp>
5 #include <ossia/editor/curve/curve_segment/easing.hpp>
13 template <
typename Easing_T>
17 key_type concreteKey()
const noexcept
final override
50 void on_startChanged()
override { dataChanged(); }
51 void on_endChanged()
override { dataChanged(); }
53 void updateData(
int numInterp)
const override
55 if(std::size_t(numInterp + 1) != m_data.size())
59 m_data.resize(numInterp + 1);
61 double start_x = start().x();
62 double end_x = end().x();
64 double start_y = start().y();
65 double end_y = end().y();
66 for(
int j = 0; j <= numInterp; j++)
68 QPointF& pt = m_data[j];
69 pt.setX(start_x + (
double(j) / numInterp) * (end_x - start_x));
70 pt.setY(start_y + (end_y - start_y) * Easing_T{}(double(j) / numInterp));
75 double valueAt(
double x)
const override
78 + (end().y() - start().y()) * (Easing_T{}(x)-start().x())
79 / (end().x() - start().x());
82 std::optional<double> verticalParameter()
const override {
return {}; }
83 std::optional<double> horizontalParameter()
const override {
return {}; }
84 void setVerticalParameter(
double p)
override { }
85 void setHorizontalParameter(
double p)
override { }
87 QVariant toSegmentSpecificData()
const override
93 ossia::curve_segment<Y> makeFunction()
const
95 return ossia::curve_segment_ease<Y, Easing_T>{};
97 ossia::curve_segment<double> makeDoubleFunction()
const override
99 return makeFunction<double>();
101 ossia::curve_segment<float> makeFloatFunction()
const override
103 return makeFunction<float>();
105 ossia::curve_segment<int> makeIntFunction()
const override
107 return makeFunction<int>();
174 CURVE_SEGMENT_METADATA(
177 CURVE_SEGMENT_METADATA(
178 ,
Curve::Segment_backOut, "0edbd8f5-67c2-41f2-ae80-f014e5c24aa6", "backOut",
180 CURVE_SEGMENT_METADATA(
181 ,
Curve::Segment_backInOut, "3825c351-698d-4930-9862-28c5f7f51c61", "backInOut",
182 "backInOut", "Easing")
183 CURVE_SEGMENT_METADATA(
184 ,
Curve::Segment_bounceIn, "51fafa98-aa8e-48f0-adae-c21c3eeb63ca", "bounceIn",
185 "bounceIn", "Easing")
186 CURVE_SEGMENT_METADATA(
187 ,
Curve::Segment_bounceOut, "75ce6961-22b3-4a9e-b989-3131098bd092", "bounceOut",
188 "bounceOut", "Easing")
189 CURVE_SEGMENT_METADATA(
190 ,
Curve::Segment_bounceInOut, "30d5c3dc-5a8c-44a8-95b4-67ca3ff5088b", "bounceInOut",
191 "bounceInOut", "Easing")
192 CURVE_SEGMENT_METADATA(
193 ,
Curve::Segment_quadraticIn, "a2f38b24-f2c9-42d7-bb5e-a51a821d2ffd", "quadraticIn",
194 "quadraticIn", "Easing")
195 CURVE_SEGMENT_METADATA(
196 ,
Curve::Segment_quadraticOut, "9717560b-fae1-4035-afbf-031f3581d132",
197 "quadraticOut", "quadraticOut", "Easing")
198 CURVE_SEGMENT_METADATA(
199 ,
Curve::Segment_quadraticInOut, "fc333d55-064a-4af8-b4a8-23fe16e80ecc",
200 "quadraticInOut", "quadraticInOut", "Easing")
201 CURVE_SEGMENT_METADATA(
202 ,
Curve::Segment_cubicIn, "b6bddf8b-b2cb-46d6-8d90-31b3029317e8", "cubicIn",
204 CURVE_SEGMENT_METADATA(
205 ,
Curve::Segment_cubicOut, "ff9a7726-2d8f-43f2-a95c-e395fdbd5aa9", "cubicOut",
206 "cubicOut", "Easing")
207 CURVE_SEGMENT_METADATA(
208 ,
Curve::Segment_cubicInOut, "21556d2a-ac8a-4acf-bf42-5eca9795047c", "cubicInOut",
209 "cubicInOut", "Easing")
210 CURVE_SEGMENT_METADATA(
211 ,
Curve::Segment_quarticIn, "72678775-535f-438e-b4bb-1077af3fab99", "quarticIn",
212 "quarticIn", "Easing")
213 CURVE_SEGMENT_METADATA(
214 ,
Curve::Segment_quarticOut, "bd6f4867-2c30-4267-aa97-0ed767883d22", "quarticOut",
215 "quarticOut", "Easing")
216 CURVE_SEGMENT_METADATA(
217 ,
Curve::Segment_quarticInOut, "93cac01a-dedc-4cb4-ad2d-d81b31e6187c",
218 "quarticInOut", "quarticInOut", "Easing")
219 CURVE_SEGMENT_METADATA(
220 ,
Curve::Segment_quinticIn, "cd08eabe-51a4-429e-8740-c097c1b34b83", "quinticIn",
221 "quinticIn", "Easing")
222 CURVE_SEGMENT_METADATA(
223 ,
Curve::Segment_quinticOut, "cb6e340b-faee-440c-8ef5-05ec6f7f4791", "quinticOut",
224 "quinticOut", "Easing")
225 CURVE_SEGMENT_METADATA(
226 ,
Curve::Segment_quinticInOut, "b2cce6a7-c651-429f-ae46-d322991e92d4",
227 "quinticInOut", "quinticInOut", "Easing")
228 CURVE_SEGMENT_METADATA(
229 ,
Curve::Segment_sineIn, "e8a44b49-4d91-4066-8e25-7669d8927792", "sineIn", "sineIn",
231 CURVE_SEGMENT_METADATA(
232 ,
Curve::Segment_sineOut, "e5d2dea4-061e-4139-8da2-1d21b0414273", "sineOut",
234 CURVE_SEGMENT_METADATA(
235 ,
Curve::Segment_sineInOut, "61bd1bb4-353b-435f-8b4c-ed61ed43bcf9", "sineInOut",
236 "sineInOut", "Easing")
237 CURVE_SEGMENT_METADATA(
238 ,
Curve::Segment_circularIn, "45b06858-2e16-4cdc-82cc-70f8545bab03", "circularIn",
239 "circularIn", "Easing")
240 CURVE_SEGMENT_METADATA(
241 ,
Curve::Segment_circularOut, "32a67b2a-61f5-49cd-b1c4-37419350fca8", "circularOut",
242 "circularOut", "Easing")
243 CURVE_SEGMENT_METADATA(
244 ,
Curve::Segment_circularInOut, "b70a58f2-2fff-4fda-b1fa-cad6c7c11b88",
245 "circularInOut", "circularInOut", "Easing")
246 CURVE_SEGMENT_METADATA(
247 ,
Curve::Segment_exponentialIn, "8db88491-bed5-4a0d-bcb6-45811c5a7722",
248 "exponentialIn", "exponentialIn", "Easing")
249 CURVE_SEGMENT_METADATA(
250 ,
Curve::Segment_exponentialOut, "40f17c1a-9611-4468-b114-c6338fb0fbb7",
251 "exponentialOut", "exponentialOut", "Easing")
252 CURVE_SEGMENT_METADATA(
253 ,
Curve::Segment_exponentialInOut, "46224c2f-f60d-4f60-93b8-a0ebe6931d00",
254 "exponentialInOut", "exponentialInOut", "Easing")
255 CURVE_SEGMENT_METADATA(
256 ,
Curve::Segment_elasticIn, "6e301164-e079-466b-a518-12fe89048283", "elasticIn",
257 "elasticIn", "Easing")
258 CURVE_SEGMENT_METADATA(
259 ,
Curve::Segment_elasticOut, "1f1fddd4-7a23-4c15-a3ec-6e88e9787a97", "elasticOut",
260 "elasticOut", "Easing")
261 CURVE_SEGMENT_METADATA(
262 ,
Curve::Segment_elasticInOut, "8bad1486-b616-4ebe-aa5e-844162545f8b",
263 "elasticInOut", "elasticInOut", "Easing")
264 CURVE_SEGMENT_METADATA(
265 ,
Curve::Segment_perlinInOut, "66cf32a5-86c5-4747-89d4-523e26dcc1fc", "perlinInOut",
266 "perlinInOut", "Easing")
Definition: EasingSegment.hpp:15
Definition: CurveSegmentModel.hpp:32
Definition: DataStreamVisitor.hpp:202
Definition: JSONVisitor.hpp:423
Definition: UuidKey.hpp:343
The id_base_t class.
Definition: Identifier.hpp:57
Utilities and base classes for 1D curves.
Definition: FocusDispatcher.hpp:12
Definition: EasingSegment.hpp:10
Definition: CurveSegmentData.hpp:63
The VisitorVariant struct.
Definition: VisitorInterface.hpp:26