60 char *valueAsString =
"linear";
62 if (value == VuoCurve_Quadratic)
63 valueAsString =
"quadratic";
64 else if (value == VuoCurve_Cubic)
65 valueAsString =
"cubic";
66 else if (value == VuoCurve_Circular)
67 valueAsString =
"circular";
68 else if (value == VuoCurve_Exponential)
69 valueAsString =
"exponential";
71 return json_object_new_string(valueAsString);
114 return startPosition;
117 if (loop == VuoLoopType_Loop)
119 normalizedTime = fmod(time/duration, 1);
121 normalizedTime = 1. + normalizedTime;
123 else if (loop == VuoLoopType_Mirror)
125 normalizedTime = fmod(time/duration, 2);
127 normalizedTime = 2. + normalizedTime;
128 if (normalizedTime > 1)
129 normalizedTime = 2. - normalizedTime;
133 if (easing == VuoCurveEasing_Out)
134 x = normalizedTime - 1.;
135 else if (easing == VuoCurveEasing_InOut)
137 if (normalizedTime < 0.5)
138 x = normalizedTime*2.;
140 x = (normalizedTime-1.)*2.;
142 else if (easing == VuoCurveEasing_Middle)
144 if (normalizedTime < 0.5)
145 x = (normalizedTime-0.5)*2.;
147 x = (normalizedTime-0.5)*2.;
151 if (curve == VuoCurve_Linear)
152 normalizedValue = fabs(x);
153 else if (curve == VuoCurve_Quadratic)
154 normalizedValue = pow(x,2);
155 else if (curve == VuoCurve_Cubic)
156 normalizedValue = pow(fabs(x),3);
157 else if (curve == VuoCurve_Circular)
158 normalizedValue = -(sqrt(1.-pow(x,2))-1.);
159 else if (curve == VuoCurve_Exponential)
160 normalizedValue = pow(2,10.*(fabs(x)-1.));
162 if (easing == VuoCurveEasing_Out)
163 normalizedValue = 1. - normalizedValue;
164 else if (easing == VuoCurveEasing_InOut)
166 if (normalizedTime < 0.5)
167 normalizedValue /= 2.;
169 normalizedValue = 1 - normalizedValue/2.;
171 else if (easing == VuoCurveEasing_Middle)
173 if (normalizedTime < 0.5)
174 normalizedValue = (1.-normalizedValue)/2.;
176 normalizedValue = (normalizedValue+1.)/2.;
179 return normalizedValue*(endPosition-startPosition) + startPosition;
188 p.x =
VuoReal_curve(time, startPosition.x, endPosition.x, duration, curve, easing, loop);
189 p.y =
VuoReal_curve(time, startPosition.y, endPosition.y, duration, curve, easing, loop);
199 p.x =
VuoReal_curve(time, startPosition.x, endPosition.x, duration, curve, easing, loop);
200 p.y =
VuoReal_curve(time, startPosition.y, endPosition.y, duration, curve, easing, loop);
201 p.z =
VuoReal_curve(time, startPosition.z, endPosition.z, duration, curve, easing, loop);