27 "title":
"UI Theme: Slider (Rounded)",
39 "VuoHorizontalAlignment",
40 "VuoVerticalAlignment"
77 VuoColor activeTrackBorderColorHovered;
83 VuoColor inactiveTrackBorderColorHovered;
85 VuoReal marginBetweenTrackAndLabel;
96 VuoJson_getObjectValue(
VuoFont, js,
"labelFont", (
VuoFont){
VuoText_make(
"Avenir-Medium"), 24,
false, (
VuoColor){1,1,1,1}, VuoHorizontalAlignment_Center, 1, 1}),
142 VuoReal _handleBorderThickness,
143 VuoReal _handleCornerRoundness,
161 VuoColor _activeTrackBorderColorHovered,
164 VuoColor _inactiveTrackColorHovered,
167 VuoColor _inactiveTrackBorderColorHovered,
169 VuoReal _marginBetweenTrackAndLabel)
171 labelFont = _labelFont;
174 labelColor = _labelColor;
175 labelColorHovered = _labelColorHovered;
177 handleWidth = _handleWidth;
178 handleHeight = _handleHeight;
179 handleBorderThickness = _handleBorderThickness;
180 handleCornerRoundness = _handleCornerRoundness;
182 handleColor = _handleColor;
183 handleColorHovered = _handleColorHovered;
184 handleColorPressed = _handleColorPressed;
186 handleBorderColor = _handleBorderColor;
187 handleBorderColorHovered = _handleBorderColorHovered;
188 handleBorderColorPressed = _handleBorderColorPressed;
190 trackDepth = _trackDepth;
191 trackBorderThickness = _trackBorderThickness;
192 trackCornerRoundness = _trackCornerRoundness;
194 activeTrackColor = _activeTrackColor;
195 activeTrackColorHovered = _activeTrackColorHovered;
197 activeTrackBorderColor = _activeTrackBorderColor;
198 activeTrackBorderColorHovered = _activeTrackBorderColorHovered;
200 inactiveTrackColor = _inactiveTrackColor;
201 inactiveTrackColorHovered = _inactiveTrackColorHovered;
203 inactiveTrackBorderColor = _inactiveTrackBorderColor;
204 inactiveTrackBorderColorHovered = _inactiveTrackBorderColorHovered;
206 marginBetweenTrackAndLabel = _marginBetweenTrackAndLabel;
223 json_object_object_add(js,
"labelColorHovered",
VuoColor_getJson(labelColorHovered));
225 json_object_object_add(js,
"handleWidth",
VuoReal_getJson(handleWidth));
226 json_object_object_add(js,
"handleHeight",
VuoReal_getJson(handleHeight));
227 json_object_object_add(js,
"handleBorderThickness",
VuoReal_getJson(handleBorderThickness));
228 json_object_object_add(js,
"handleCornerRoundness",
VuoReal_getJson(handleCornerRoundness));
231 json_object_object_add(js,
"handleColorHovered",
VuoColor_getJson(handleColorHovered));
232 json_object_object_add(js,
"handleColorPressed",
VuoColor_getJson(handleColorPressed));
234 json_object_object_add(js,
"handleBorderColor",
VuoColor_getJson(handleBorderColor));
235 json_object_object_add(js,
"handleBorderColorHovered",
VuoColor_getJson(handleBorderColorHovered));
236 json_object_object_add(js,
"handleBorderColorPressed",
VuoColor_getJson(handleBorderColorPressed));
239 json_object_object_add(js,
"trackBorderThickness",
VuoReal_getJson(trackBorderThickness));
240 json_object_object_add(js,
"trackCornerRoundness",
VuoReal_getJson(trackCornerRoundness));
242 json_object_object_add(js,
"activeTrackColor",
VuoColor_getJson(activeTrackColor));
243 json_object_object_add(js,
"activeTrackColorHovered",
VuoColor_getJson(activeTrackColorHovered));
245 json_object_object_add(js,
"activeTrackBorderColor",
VuoColor_getJson(activeTrackBorderColor));
246 json_object_object_add(js,
"activeTrackBorderColorHovered",
VuoColor_getJson(activeTrackBorderColorHovered));
248 json_object_object_add(js,
"inactiveTrackColor",
VuoColor_getJson(inactiveTrackColor));
249 json_object_object_add(js,
"inactiveTrackColorHovered",
VuoColor_getJson(inactiveTrackColorHovered));
251 json_object_object_add(js,
"inactiveTrackBorderColor",
VuoColor_getJson(inactiveTrackBorderColor));
252 json_object_object_add(js,
"inactiveTrackBorderColorHovered",
VuoColor_getJson(inactiveTrackBorderColorHovered));
254 json_object_object_add(js,
"marginBetweenTrackAndLabel",
VuoReal_getJson(marginBetweenTrackAndLabel));
264 return strdup(
"Slider Theme (Rounded)");
280 &&
VuoReal_areEqual(handleBorderThickness, thatSpecialized->handleBorderThickness)
281 &&
VuoReal_areEqual(handleCornerRoundness, thatSpecialized->handleCornerRoundness)
288 &&
VuoColor_areEqual(handleBorderColorHovered, thatSpecialized->handleBorderColorHovered)
289 &&
VuoColor_areEqual(handleBorderColorPressed, thatSpecialized->handleBorderColorPressed)
292 &&
VuoReal_areEqual(trackBorderThickness, thatSpecialized->trackBorderThickness)
293 &&
VuoReal_areEqual(trackCornerRoundness, thatSpecialized->trackCornerRoundness)
296 &&
VuoColor_areEqual(activeTrackColorHovered, thatSpecialized->activeTrackColorHovered)
298 &&
VuoColor_areEqual(activeTrackBorderColor, thatSpecialized->activeTrackBorderColor)
299 &&
VuoColor_areEqual(activeTrackBorderColorHovered, thatSpecialized->activeTrackBorderColorHovered)
302 &&
VuoColor_areEqual(inactiveTrackColorHovered, thatSpecialized->inactiveTrackColorHovered)
304 &&
VuoColor_areEqual(inactiveTrackBorderColor, thatSpecialized->inactiveTrackBorderColor)
305 &&
VuoColor_areEqual(inactiveTrackBorderColorHovered, thatSpecialized->inactiveTrackBorderColorHovered)
307 &&
VuoReal_areEqual(marginBetweenTrackAndLabel, thatSpecialized->marginBetweenTrackAndLabel);
381 orientation == VuoOrientation_Horizontal,
409 float width = orientation == VuoOrientation_Horizontal ? trackLength : trackDepth;
410 float height = orientation == VuoOrientation_Horizontal ? trackDepth : trackLength;
412 float outerTrackWidth = width + trackBorderThickness * 2;
413 float outerTrackHeight = height + trackBorderThickness * 2;
414 float innerTrackCornerRoundness = (outerTrackHeight - trackBorderThickness * 2 - (outerTrackHeight * (1 - trackCornerRoundness))) / (outerTrackHeight - trackBorderThickness * 2);
417 float hhml = trackLength - (trackLength - hml)/2;
418 float innerProgress = (trackLength - hhml)/trackLength + normalizedProgress * (trackLength - (trackLength - hhml) * 2) / trackLength;
419 float outerProgress = (trackBorderThickness + innerProgress * trackLength) / (trackLength + trackBorderThickness * 2);
422 isHovered ? inactiveTrackColorHovered : inactiveTrackColor,
423 isHovered ? activeTrackColorHovered : activeTrackColor,
429 innerTrackCornerRoundness,
434 isHovered ? inactiveTrackBorderColorHovered : inactiveTrackBorderColor,
435 isHovered ? activeTrackBorderColorHovered : activeTrackBorderColor,
441 trackCornerRoundness,
452 float width = orientation == VuoOrientation_Horizontal ? handleWidth : handleHeight;
453 float height = orientation == VuoOrientation_Horizontal ? handleHeight : handleWidth;
456 float handlePos =
VuoReal_lerp(-hml / 2, hml / 2, normalizedProgress);
457 VuoPoint2d handlePosition = (VuoPoint2d){
458 orientation == VuoOrientation_Horizontal ? handlePos : 0,
459 orientation == VuoOrientation_Horizontal ? 0 : handlePos,
462 float outerHandleWidth = width + handleBorderThickness * 2;
463 float outerHandleHeight = height + handleBorderThickness * 2;
464 float innerHandleCornerRoundness = (outerHandleHeight - handleBorderThickness * 2 - (outerHandleHeight * (1 - handleCornerRoundness))) / (outerHandleHeight - handleBorderThickness * 2);
467 isPressed ? handleColorPressed : (isHovered ? handleColorHovered : handleColor),
473 innerHandleCornerRoundness);
476 isPressed ? handleBorderColorPressed : (isHovered ? handleBorderColorHovered : handleBorderColor),
482 handleCornerRoundness);
488 (VuoPoint2d){ 0, (float)-marginBetweenTrackAndLabel / 2 },
490 outerHandleWidth + (orientation == VuoOrientation_Horizontal ? hml : 0),
491 outerHandleHeight + (orientation == VuoOrientation_Horizontal ? 0 : hml) + marginBetweenTrackAndLabel);
503 f.color = (
VuoColor){ f.color.r * labelColorHovered.r,
504 f.color.g * labelColorHovered.g,
505 f.color.b * labelColorHovered.b,
506 f.color.a * labelColorHovered.a };
508 f.color = (
VuoColor){ f.color.r * labelColor.r,
509 f.color.g * labelColor.g,
510 f.color.b * labelColor.b,
511 f.color.a * labelColor.a };
513 float yOffset = -marginBetweenTrackAndLabel;
514 if (orientation == VuoOrientation_Horizontal)
515 yOffset -= fmax(trackDepth + trackBorderThickness, handleHeight + handleBorderThickness) / 2;
517 yOffset -= fmax(trackLength + trackBorderThickness,
handleMovementLength(trackLength) + handleWidth + handleBorderThickness) / 2;
522 (VuoPoint3d){ 0, 0, 0 },
523 (VuoPoint3d){ 1, 1, 1 });
528 return VuoLayer_setAnchor(groupLayer, anchor, renderedLayers.pixelsWide, renderedLayers.pixelsHigh, renderedLayers.backingScaleFactor);
540 VuoPoint2d pointToTest)
542 float width = orientation == VuoOrientation_Horizontal ? handleWidth : handleHeight;
543 float height = orientation == VuoOrientation_Horizontal ? handleHeight : handleWidth;
546 float handlePos =
VuoReal_lerp(-hml / 2, hml / 2, normalizedProgress);
547 VuoPoint2d handlePosition = (VuoPoint2d){
548 orientation == VuoOrientation_Horizontal ? handlePos : 0,
549 orientation == VuoOrientation_Horizontal ? 0 : handlePos,
552 float outerHandleWidth = width + handleBorderThickness * 2;
553 float outerHandleHeight = height + handleBorderThickness * 2;
556 (VuoPoint2d){ pointToTest.x - position.x, pointToTest.y - position.y });
564 return trackDepth * trackCornerRoundness;
573 return trackLength - trackDepth * trackCornerRoundness;
607 VuoColor activeTrackBorderColorHovered,
613 VuoColor inactiveTrackBorderColorHovered,
615 VuoReal marginBetweenTrackAndLabel)
623 handleBorderThickness,
624 handleCornerRoundness,
631 handleBorderColorHovered,
632 handleBorderColorPressed,
635 trackBorderThickness,
636 trackCornerRoundness,
639 activeTrackColorHovered,
641 activeTrackBorderColor,
642 activeTrackBorderColorHovered,
645 inactiveTrackColorHovered,
647 inactiveTrackBorderColor,
648 inactiveTrackBorderColorHovered,
650 marginBetweenTrackAndLabel));