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);
380 orientation == VuoOrientation_Horizontal,
408 float width = orientation == VuoOrientation_Horizontal ? trackLength : trackDepth;
409 float height = orientation == VuoOrientation_Horizontal ? trackDepth : trackLength;
411 float outerTrackWidth = width + trackBorderThickness * 2;
412 float outerTrackHeight = height + trackBorderThickness * 2;
413 float innerTrackCornerRoundness = (outerTrackHeight - trackBorderThickness * 2 - (outerTrackHeight * (1 - trackCornerRoundness))) / (outerTrackHeight - trackBorderThickness * 2);
416 float hhml = trackLength - (trackLength - hml)/2;
417 float innerProgress = (trackLength - hhml)/trackLength + normalizedProgress * (trackLength - (trackLength - hhml) * 2) / trackLength;
418 float outerProgress = (trackBorderThickness + innerProgress * trackLength) / (trackLength + trackBorderThickness * 2);
421 isHovered ? inactiveTrackColorHovered : inactiveTrackColor,
422 isHovered ? activeTrackColorHovered : activeTrackColor,
428 innerTrackCornerRoundness,
433 isHovered ? inactiveTrackBorderColorHovered : inactiveTrackBorderColor,
434 isHovered ? activeTrackBorderColorHovered : activeTrackBorderColor,
440 trackCornerRoundness,
451 float width = orientation == VuoOrientation_Horizontal ? handleWidth : handleHeight;
452 float height = orientation == VuoOrientation_Horizontal ? handleHeight : handleWidth;
455 float handlePos =
VuoReal_lerp(-hml / 2, hml / 2, normalizedProgress);
456 VuoPoint2d handlePosition = (VuoPoint2d){
457 orientation == VuoOrientation_Horizontal ? handlePos : 0,
458 orientation == VuoOrientation_Horizontal ? 0 : handlePos,
461 float outerHandleWidth = width + handleBorderThickness * 2;
462 float outerHandleHeight = height + handleBorderThickness * 2;
463 float innerHandleCornerRoundness = (outerHandleHeight - handleBorderThickness * 2 - (outerHandleHeight * (1 - handleCornerRoundness))) / (outerHandleHeight - handleBorderThickness * 2);
466 isPressed ? handleColorPressed : (isHovered ? handleColorHovered : handleColor),
472 innerHandleCornerRoundness);
475 isPressed ? handleBorderColorPressed : (isHovered ? handleBorderColorHovered : handleBorderColor),
481 handleCornerRoundness);
487 (VuoPoint2d){ 0, (float)-marginBetweenTrackAndLabel / 2 },
489 outerHandleWidth + (orientation == VuoOrientation_Horizontal ? hml : 0),
490 outerHandleHeight + (orientation == VuoOrientation_Horizontal ? 0 : hml) + marginBetweenTrackAndLabel);
502 f.color = (
VuoColor){ f.color.r * labelColorHovered.r,
503 f.color.g * labelColorHovered.g,
504 f.color.b * labelColorHovered.b,
505 f.color.a * labelColorHovered.a };
507 f.color = (
VuoColor){ f.color.r * labelColor.r,
508 f.color.g * labelColor.g,
509 f.color.b * labelColor.b,
510 f.color.a * labelColor.a };
512 float yOffset = -marginBetweenTrackAndLabel;
513 if (orientation == VuoOrientation_Horizontal)
514 yOffset -= fmax(trackDepth + trackBorderThickness, handleHeight + handleBorderThickness) / 2;
516 yOffset -= fmax(trackLength + trackBorderThickness,
handleMovementLength(trackLength) + handleWidth + handleBorderThickness) / 2;
520 (VuoPoint3d){ 0, 0, 0 },
521 (VuoPoint3d){ 1, 1, 1 }));
527 unsigned long int pixelsWide, pixelsHigh;
528 float backingScaleFactor;
536 return VuoLayer_setAnchor(groupLayer, anchor, pixelsWide, pixelsHigh, backingScaleFactor);
548 VuoPoint2d pointToTest)
550 float width = orientation == VuoOrientation_Horizontal ? handleWidth : handleHeight;
551 float height = orientation == VuoOrientation_Horizontal ? handleHeight : handleWidth;
554 float handlePos =
VuoReal_lerp(-hml / 2, hml / 2, normalizedProgress);
555 VuoPoint2d handlePosition = (VuoPoint2d){
556 orientation == VuoOrientation_Horizontal ? handlePos : 0,
557 orientation == VuoOrientation_Horizontal ? 0 : handlePos,
560 float outerHandleWidth = width + handleBorderThickness * 2;
561 float outerHandleHeight = height + handleBorderThickness * 2;
564 (VuoPoint2d){ pointToTest.x - position.x, pointToTest.y - position.y });
572 return trackDepth * trackCornerRoundness;
581 return trackLength - trackDepth * trackCornerRoundness;
615 VuoColor activeTrackBorderColorHovered,
621 VuoColor inactiveTrackBorderColorHovered,
623 VuoReal marginBetweenTrackAndLabel)
631 handleBorderThickness,
632 handleCornerRoundness,
639 handleBorderColorHovered,
640 handleBorderColorPressed,
643 trackBorderThickness,
644 trackCornerRoundness,
647 activeTrackColorHovered,
649 activeTrackBorderColor,
650 activeTrackBorderColorHovered,
653 inactiveTrackColorHovered,
655 inactiveTrackBorderColor,
656 inactiveTrackBorderColorHovered,
658 marginBetweenTrackAndLabel));