This commit is contained in:
Brady Hahn 2026-04-27 02:14:43 +01:00 committed by GitHub
commit 6d0b30264e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

21
clay.h
View file

@ -563,6 +563,7 @@ typedef struct {
Clay_BoundingBox boundingBox;
Clay_Color backgroundColor;
Clay_Color overlayColor;
Clay_CornerRadius cornerRadius;
Clay_Color borderColor;
Clay_BorderWidth borderWidth;
} Clay_TransitionData;
@ -4436,6 +4437,9 @@ void Clay_ApplyTransitionedPropertiesToElement(Clay_LayoutElement* currentElemen
if (properties & CLAY_TRANSITION_PROPERTY_BACKGROUND_COLOR) {
currentElement->config.backgroundColor = currentTransitionData.backgroundColor;
}
if (properties & CLAY_TRANSITION_PROPERTY_CORNER_RADIUS) {
currentElement->config.cornerRadius = currentTransitionData.cornerRadius;
}
if (properties & CLAY_TRANSITION_PROPERTY_BORDER_COLOR) {
currentElement->config.border.color = currentTransitionData.borderColor;
}
@ -4580,6 +4584,7 @@ Clay_RenderCommandArray Clay_EndLayout(float deltaTime) {
mapItem->boundingBox,
currentElement->config.backgroundColor,
currentElement->config.overlayColor,
currentElement->config.cornerRadius,
currentElement->config.border.color,
currentElement->config.border.width,
};
@ -4647,6 +4652,14 @@ Clay_RenderCommandArray Clay_EndLayout(float deltaTime) {
newActiveProperties |= CLAY_TRANSITION_PROPERTY_OVERLAY_COLOR;
}
}
if (properties & CLAY_TRANSITION_PROPERTY_CORNER_RADIUS) {
if (!Clay__FloatEqual(oldTargetState.cornerRadius.topLeft, targetState.cornerRadius.topLeft)
|| !Clay__FloatEqual(oldTargetState.cornerRadius.topRight, targetState.cornerRadius.topRight)
|| !Clay__FloatEqual(oldTargetState.cornerRadius.bottomLeft, targetState.cornerRadius.bottomLeft)
|| !Clay__FloatEqual(oldTargetState.cornerRadius.bottomRight, targetState.cornerRadius.bottomRight)) {
activeProperties |= CLAY_TRANSITION_PROPERTY_CORNER_RADIUS;
}
}
if (properties & CLAY_TRANSITION_PROPERTY_BORDER_COLOR) {
if (!Clay__MemCmp((char *) &oldTargetState.borderColor, (char *)&targetState.borderColor, sizeof(Clay_Color))) {
newActiveProperties |= CLAY_TRANSITION_PROPERTY_BORDER_COLOR;
@ -4969,6 +4982,14 @@ CLAY_DLL_EXPORT bool Clay_EaseOut(Clay_TransitionCallbackArguments arguments) {
.a = CLAY__LERP(arguments.initial.overlayColor.a, arguments.target.overlayColor.a, lerpAmount),
};
}
if (arguments.properties & CLAY_TRANSITION_PROPERTY_CORNER_RADIUS) {
arguments.current->cornerRadius = CLAY__INIT(Clay_CornerRadius) {
.topLeft = CLAY__LERP(arguments.initial.cornerRadius.topLeft, arguments.target.cornerRadius.topLeft, lerpAmount),
.topRight = CLAY__LERP(arguments.initial.cornerRadius.topRight, arguments.target.cornerRadius.topRight, lerpAmount),
.bottomLeft = CLAY__LERP(arguments.initial.cornerRadius.bottomLeft, arguments.target.cornerRadius.bottomLeft, lerpAmount),
.bottomRight = CLAY__LERP(arguments.initial.cornerRadius.bottomRight, arguments.target.cornerRadius.bottomRight, lerpAmount),
};
}
if (arguments.properties & CLAY_TRANSITION_PROPERTY_BORDER_COLOR) {
arguments.current->borderColor = CLAY__INIT(Clay_Color) {
.r = CLAY__LERP(arguments.initial.borderColor.r, arguments.target.borderColor.r, lerpAmount),