Pendulum swing
Pendulum swing: a CSS button. Copy the rules, or the prompt that rebuilds it.
CSS
.btn-124 {
font: 600 15px/1 system-ui,sans-serif;
color: #fff;
background: #b45309;
border: 0;
border-radius: 8px;
padding: 14px 28px;
cursor: pointer;
transform-origin: top center;
transition: background .2s
}
.btn-124:hover {
animation: swing124 1s ease-in-out;
background: #92400e
}
.btn-124:focus-visible {
outline: 2px solid #b45309;
outline-offset: 4px
}
.btn-124:active {
transform: rotate(0) translateY(1px);
background: #78350f
}
@keyframes swing124 {
20% {
transform: rotate(6deg)
}
40% {
transform: rotate(-5deg)
}
60% {
transform: rotate(3deg)
}
80% {
transform: rotate(-2deg)
}
100% {
transform: rotate(0)
}
}
@media (prefers-reduced-motion: reduce) {
.btn-124, .btn-124 * { animation: none; transition: none; }
}
HTML
<button class="btn-124">Swing</button>Prompt
An amber-brown #b45309 button, 8px radius, white 15px semibold text, 14px by 28px padding, with its transform origin at the top centre so it hangs like a sign. On hover it swings once (6deg, -5deg, 3deg, -2deg, settle) over 1 second and darkens to #92400e. Active drops 1px on #78350f. Focus 2px amber outline offset 4px.