Skip to content

Coin Mint

Purchase button with coin drop, spin, stamp, and golden shine animation

Coin Mint

by FreeCsStyles Dev's

AnimatedStorybook
🌐🎨⚛️💚🅰️🔥☁️
#coin#mint#purchase#gold#animation#transaction

Embed this component

Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/coin-mint.

<iframe src="/embed/coin-mint" sandbox="allow-scripts" loading="lazy" title="Coin Mint" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Coin Mint, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.

HTML
<div class="coin-mint-container">
  <button class="coin-mint-button" onclick="mintCoin()">
    <span class="coin-icon">🪙</span>
    <span class="button-text">Purchase</span>
    <div class="coin-drop"></div>
    <div class="coin-spin"></div>
    <div class="coin-stamp"></div>
    <div class="golden-shine"></div>
    <div class="receipt"></div>
  </button>
</div>
CSS
.coin-mint-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.coin-mint-button {
  position: relative;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border: none;
  border-radius: 0.75rem;
  color: #1f2937;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.coin-mint-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.coin-icon {
  margin-right: 0.5rem;
  transition: transform 0.3s ease;
}

.coin-drop {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background: #fbbf24;
  border-radius: 50%;
  opacity: 0;
}

.coin-mint-button.animating .coin-drop {
  animation: coin-drop 0.6s ease-out forwards;
}

@keyframes coin-drop {
  0% { top: -20px; opacity: 1; }
  70% { top: 20px; opacity: 1; }
  100% { top: 15px; opacity: 1; }
}

.coin-spin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  border-radius: 50%;
  opacity: 0;
}

.coin-mint-button.animating .coin-spin {
  animation: coin-spin 0.8s ease-in-out 0.6s forwards;
}

@keyframes coin-spin {
  0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.5) rotate(180deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(360deg); opacity: 1; }
}

.coin-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 40px;
  height: 40px;
  border: 3px solid #059669;
  border-radius: 50%;
  opacity: 0;
}

.coin-mint-button.animating .coin-stamp {
  animation: coin-stamp 0.4s ease-out 1.4s forwards;
}

@keyframes coin-stamp {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.golden-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  opacity: 0;
}

.coin-mint-button.animating .golden-shine {
  animation: golden-shine 0.8s ease-in-out 1.8s forwards;
}

@keyframes golden-shine {
  0% { left: -100%; opacity: 0; }
  50% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

.receipt {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 20px;
  background: white;
  border-radius: 0 0 0.5rem 0.5rem;
  opacity: 0;
}

.coin-mint-button.animating .receipt {
  animation: receipt-appear 0.5s ease-out 2.2s forwards;
}

@keyframes receipt-appear {
  0% { bottom: -30px; opacity: 0; }
  100% { bottom: -10px; opacity: 1; }
}

.coin-mint-button.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.coin-mint-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .coin-mint-button.animating * {
    animation: none !important;
  }
}
Tailwind CSS
<div class="flex justify-center items-center p-8">
  <button class="relative px-8 py-4 bg-gradient-to-r from-yellow-400 to-amber-500 text-gray-800 font-bold rounded-xl overflow-hidden transition-all hover:-translate-y-1 hover:shadow-lg hover:shadow-amber-500/40 active:scale-95">
    <span class="mr-2">🪙</span>
    <span>Purchase</span>
    <div class="absolute inset-0 pointer-events-none">
      <div class="absolute top-1/2 left-1/2 w-8 h-8 bg-gradient-to-br from-yellow-400 to-amber-600 rounded-full -translate-x-1/2 -translate-y-1/2 scale-0 animate-spin-slow"></div>
      <div class="absolute inset-0 bg-gradient-to-r from-transparent via-white/40 to-transparent -translate-x-full animate-shine"></div>
    </div>
  </button>
</div>

<style>
@keyframes spin-slow {
  0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); }
  50% { transform: translate(-50%, -50%) scale(1.5) rotate(180deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(360deg); }
}
@keyframes shine {
  0% { transform: translateX(-100%); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}
.animate-spin-slow { animation: spin-slow 2s ease-in-out infinite; }
.animate-shine { animation: shine 2s ease-in-out infinite; }
</style>
React
import { useState, useEffect } from 'react';

function CoinMintButton() {
  const [phase, setPhase] = useState('idle');
  
  const handleClick = () => {
    if (phase === 'animating') return;
    setPhase('animating');
    
    setTimeout(() => {
      setPhase('success');
      setTimeout(() => setPhase('idle'), 2000);
    }, 2500);
  };
  
  return (
    <>
      <style>{`
        .coin-mint-btn {
          position: relative;
          padding: 1rem 2rem;
          background: linear-gradient(135deg, #fbbf24, #f59e0b);
          border: none;
          border-radius: 0.75rem;
          color: #1f2937;
          font-weight: 700;
          cursor: pointer;
          overflow: hidden;
          transition: all 0.3s ease;
          box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
        }
        .coin-mint-btn.animating {
          background: linear-gradient(135deg, #fbbf24, #d97706);
        }
        .coin-mint-btn.success {
          background: linear-gradient(135deg, #10b981, #059669);
          color: white;
        }
        .coin-mint-btn:hover:not(:disabled) {
          transform: translateY(-2px);
          box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
        }
        .coin-element {
          position: absolute;
          border-radius: 50%;
          opacity: 0;
        }
        .coin-drop {
          top: -20px;
          left: 50%;
          width: 20px;
          height: 20px;
          background: #fbbf24;
          transform: translateX(-50%);
        }
        .coin-spin {
          top: 50%;
          left: 50%;
          width: 30px;
          height: 30px;
          background: linear-gradient(135deg, #fbbf24, #d97706);
          transform: translate(-50%, -50%) scale(0);
        }
        .coin-stamp {
          top: 50%;
          left: 50%;
          width: 40px;
          height: 40px;
          border: 3px solid #059669;
          background: transparent;
          transform: translate(-50%, -50%) scale(0);
        }
        .golden-shine {
          top: 0;
          left: -100%;
          width: 100%;
          height: 100%;
          background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
        }
        .receipt {
          bottom: -30px;
          left: 50%;
          width: 80%;
          height: 20px;
          background: white;
          border-radius: 0 0 0.5rem 0.5rem;
          transform: translateX(-50%);
        }
        @keyframes coinDrop {
          0% { top: -20px; opacity: 1; }
          70% { top: 20px; opacity: 1; }
          100% { top: 15px; opacity: 1; }
        }
        @keyframes coinSpin {
          0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 1; }
          50% { transform: translate(-50%, -50%) scale(1.5) rotate(180deg); opacity: 1; }
          100% { transform: translate(-50%, -50%) scale(1) rotate(360deg); opacity: 1; }
        }
        @keyframes coinStamp {
          0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
          70% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
          100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
        }
        @keyframes goldenShine {
          0% { left: -100%; opacity: 0; }
          50% { opacity: 1; }
          100% { left: 100%; opacity: 0; }
        }
        @keyframes receiptAppear {
          0% { bottom: -30px; opacity: 0; }
          100% { bottom: -10px; opacity: 1; }
        }
      `}</style>
      <button
        className={`coin-mint-btn ${phase}`}
        onClick={handleClick}
        disabled={phase === 'animating'}
      >
        <span className="mr-2">🪙</span>
        <span>{phase === 'success' ? 'Purchased!' : 'Purchase'}</span>
        {phase === 'animating' && (
          <>
            <div className="coin-element coin-drop" style={{ animation: 'coinDrop 0.6s ease-out forwards' }}></div>
            <div className="coin-element coin-spin" style={{ animation: 'coinSpin 0.8s ease-in-out 0.6s forwards' }}></div>
            <div className="coin-element coin-stamp" style={{ animation: 'coinStamp 0.4s ease-out 1.4s forwards' }}></div>
            <div className="coin-element golden-shine" style={{ animation: 'goldenShine 0.8s ease-in-out 1.8s forwards' }}></div>
            <div className="coin-element receipt" style={{ animation: 'receiptAppear 0.5s ease-out 2.2s forwards' }}></div>
          </>
        )}
      </button>
    </>
  );
}

export default CoinMintButton;
Vue
<template>
  <div class="coin-mint-container">
    <button
      :class="['coin-mint-button', phase]"
      @click="handleClick"
      :disabled="phase === 'animating'"
    >
      <span class="coin-icon">🪙</span>
      <span class="button-text">{{ phase === 'success' ? 'Purchased!' : 'Purchase' }}</span>
      <div v-if="phase === 'animating'" class="animation-elements">
        <div class="coin-element coin-drop"></div>
        <div class="coin-element coin-spin"></div>
        <div class="coin-element coin-stamp"></div>
        <div class="coin-element golden-shine"></div>
        <div class="coin-element receipt"></div>
      </div>
    </button>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const phase = ref('idle');

const handleClick = () => {
  if (phase.value === 'animating') return;
  phase.value = 'animating';
  
  setTimeout(() => {
    phase.value = 'success';
    setTimeout(() => {
      phase.value = 'idle';
    }, 2000);
  }, 2500);
};
</script>

<style scoped>
.coin-mint-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.coin-mint-button {
  position: relative;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border: none;
  border-radius: 0.75rem;
  color: #1f2937;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.coin-mint-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.coin-mint-button.animating {
  background: linear-gradient(135deg, #fbbf24, #d97706);
}

.coin-mint-button.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.coin-icon {
  margin-right: 0.5rem;
}

.coin-element {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
}

.coin-drop {
  top: -20px;
  left: 50%;
  width: 20px;
  height: 20px;
  background: #fbbf24;
  transform: translateX(-50%);
  animation: coinDrop 0.6s ease-out forwards;
}

.coin-spin {
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  transform: translate(-50%, -50%) scale(0);
  animation: coinSpin 0.8s ease-in-out 0.6s forwards;
}

.coin-stamp {
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border: 3px solid #059669;
  background: transparent;
  transform: translate(-50%, -50%) scale(0);
  animation: coinStamp 0.4s ease-out 1.4s forwards;
}

.golden-shine {
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: goldenShine 0.8s ease-in-out 1.8s forwards;
}

.receipt {
  bottom: -30px;
  left: 50%;
  width: 80%;
  height: 20px;
  background: white;
  border-radius: 0 0 0.5rem 0.5rem;
  transform: translateX(-50%);
  animation: receiptAppear 0.5s ease-out 2.2s forwards;
}

@keyframes coinDrop {
  0% { top: -20px; opacity: 1; }
  70% { top: 20px; opacity: 1; }
  100% { top: 15px; opacity: 1; }
}

@keyframes coinSpin {
  0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.5) rotate(180deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(360deg); opacity: 1; }
}

@keyframes coinStamp {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes goldenShine {
  0% { left: -100%; opacity: 0; }
  50% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

@keyframes receiptAppear {
  0% { bottom: -30px; opacity: 0; }
  100% { bottom: -10px; opacity: 1; }
}

.coin-mint-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .coin-mint-button.animating .coin-element {
    animation: none !important;
  }
}
</style>
Svelte
<script>
  let phase = 'idle';
  
  function handleClick() {
    if (phase === 'animating') return;
    phase = 'animating';
    
    setTimeout(() => {
      phase = 'success';
      setTimeout(() => {
        phase = 'idle';
      }, 2000);
    }, 2500);
  }
</script>

<div class="coin-mint-container">
  <button class="coin-mint-button {phase}" on:click={handleClick} disabled={phase === 'animating'}>
    <span class="coin-icon">🪙</span>
    <span class="button-text">{phase === 'success' ? 'Purchased!' : 'Purchase'}</span>
    {#if phase === 'animating'}
      <div class="coin-element coin-drop"></div>
      <div class="coin-element coin-spin"></div>
      <div class="coin-element coin-stamp"></div>
      <div class="coin-element golden-shine"></div>
      <div class="coin-element receipt"></div>
    {/if}
  </button>
</div>

<style>
  .coin-mint-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
  }
  .coin-mint-button {
    position: relative;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none;
    border-radius: 0.75rem;
    color: #1f2937;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
  }
  .coin-mint-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
  }
  .coin-mint-button.animating {
    background: linear-gradient(135deg, #fbbf24, #d97706);
  }
  .coin-mint-button.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
  }
  .coin-icon { margin-right: 0.5rem; }
  .coin-element { position: absolute; border-radius: 50%; opacity: 0; }
  .coin-drop { top: -20px; left: 50%; width: 20px; height: 20px; background: #fbbf24; transform: translateX(-50%); animation: coinDrop 0.6s ease-out forwards; }
  .coin-spin { top: 50%; left: 50%; width: 30px; height: 30px; background: linear-gradient(135deg, #fbbf24, #d97706); transform: translate(-50%, -50%) scale(0); animation: coinSpin 0.8s ease-in-out 0.6s forwards; }
  .coin-stamp { top: 50%; left: 50%; width: 40px; height: 40px; border: 3px solid #059669; background: transparent; transform: translate(-50%, -50%) scale(0); animation: coinStamp 0.4s ease-out 1.4s forwards; }
  .golden-shine { top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent); animation: goldenShine 0.8s ease-in-out 1.8s forwards; }
  .receipt { bottom: -30px; left: 50%; width: 80%; height: 20px; background: white; border-radius: 0 0 0.5rem 0.5rem; transform: translateX(-50%); animation: receiptAppear 0.5s ease-out 2.2s forwards; }
  @keyframes coinDrop { 0% { top: -20px; opacity: 1; } 70% { top: 20px; opacity: 1; } 100% { top: 15px; opacity: 1; } }
  @keyframes coinSpin { 0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 1; } 50% { transform: translate(-50%, -50%) scale(1.5) rotate(180deg); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1) rotate(360deg); opacity: 1; } }
  @keyframes coinStamp { 0% { transform: translate(-50%, -50%) scale(0); opacity: 1; } 70% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
  @keyframes goldenShine { 0% { left: -100%; opacity: 0; } 50% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
  @keyframes receiptAppear { 0% { bottom: -30px; opacity: 0; } 100% { bottom: -10px; opacity: 1; } }
  .coin-mint-button:disabled { opacity: 0.7; cursor: not-allowed; }
  @media (prefers-reduced-motion: reduce) { .coin-mint-button.animating .coin-element { animation: none !important; } }
</style>
Angular
import { Component } from '@angular/core';

@Component({
  selector: 'app-coin-mint-button',
  template: `
    <div class="coin-mint-container">
      <button
        [class]="'coin-mint-button ' + phase"
        (click)="handleClick()"
        [disabled]="phase === 'animating'"
      >
        <span class="coin-icon">🪙</span>
        <span class="button-text">{{ phase === 'success' ? 'Purchased!' : 'Purchase' }}</span>
        <div *ngIf="phase === 'animating'" class="animation-elements">
          <div class="coin-element coin-drop"></div>
          <div class="coin-element coin-spin"></div>
          <div class="coin-element coin-stamp"></div>
          <div class="coin-element golden-shine"></div>
          <div class="coin-element receipt"></div>
        </div>
      </button>
    </div>
  `,
  styles: [`
    .coin-mint-container {
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 2rem;
    }
    .coin-mint-button {
      position: relative;
      padding: 1rem 2rem;
      background: linear-gradient(135deg, #fbbf24, #f59e0b);
      border: none;
      border-radius: 0.75rem;
      color: #1f2937;
      font-weight: 700;
      cursor: pointer;
      overflow: hidden;
      transition: all 0.3s ease;
      box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    }
    .coin-mint-button:hover:not(:disabled) {
      transform: translateY(-2px);
      box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
    }
    .coin-mint-button.animating {
      background: linear-gradient(135deg, #fbbf24, #d97706);
    }
    .coin-mint-button.success {
      background: linear-gradient(135deg, #10b981, #059669);
      color: white;
    }
    .coin-icon { margin-right: 0.5rem; }
    .coin-element { position: absolute; border-radius: 50%; opacity: 0; }
    .coin-drop { top: -20px; left: 50%; width: 20px; height: 20px; background: #fbbf24; transform: translateX(-50%); animation: coinDrop 0.6s ease-out forwards; }
    .coin-spin { top: 50%; left: 50%; width: 30px; height: 30px; background: linear-gradient(135deg, #fbbf24, #d97706); transform: translate(-50%, -50%) scale(0); animation: coinSpin 0.8s ease-in-out 0.6s forwards; }
    .coin-stamp { top: 50%; left: 50%; width: 40px; height: 40px; border: 3px solid #059669; background: transparent; transform: translate(-50%, -50%) scale(0); animation: coinStamp 0.4s ease-out 1.4s forwards; }
    .golden-shine { top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent); animation: goldenShine 0.8s ease-in-out 1.8s forwards; }
    .receipt { bottom: -30px; left: 50%; width: 80%; height: 20px; background: white; border-radius: 0 0 0.5rem 0.5rem; transform: translateX(-50%); animation: receiptAppear 0.5s ease-out 2.2s forwards; }
    @keyframes coinDrop { 0% { top: -20px; opacity: 1; } 70% { top: 20px; opacity: 1; } 100% { top: 15px; opacity: 1; } }
    @keyframes coinSpin { 0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 1; } 50% { transform: translate(-50%, -50%) scale(1.5) rotate(180deg); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1) rotate(360deg); opacity: 1; } }
    @keyframes coinStamp { 0% { transform: translate(-50%, -50%) scale(0); opacity: 1; } 70% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
    @keyframes goldenShine { 0% { left: -100%; opacity: 0; } 50% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
    @keyframes receiptAppear { 0% { bottom: -30px; opacity: 0; } 100% { bottom: -10px; opacity: 1; } }
    .coin-mint-button:disabled { opacity: 0.7; cursor: not-allowed; }
    @media (prefers-reduced-motion: reduce) { .coin-mint-button.animating .coin-element { animation: none !important; } }
  `]
})
export class CoinMintButtonComponent {
  phase = 'idle';

  handleClick(): void {
    if (this.phase === 'animating') return;
    this.phase = 'animating';
    
    setTimeout(() => {
      this.phase = 'success';
      setTimeout(() => {
        this.phase = 'idle';
      }, 2000);
    }, 2500);
  }
}
LWC — HTML template
<template>
  <div class="coin-mint-container">
    <button class="coin-mint-button {buttonClass}" onclick={handleClick} disabled={isAnimating}>
      <span class="coin-icon">🪙</span>
      <span class="button-text">{buttonText}</span>
      <template if:true={isAnimating}>
        <div class="coin-element coin-drop"></div>
        <div class="coin-element coin-spin"></div>
        <div class="coin-element coin-stamp"></div>
        <div class="coin-element golden-shine"></div>
        <div class="coin-element receipt"></div>
      </template>
    </button>
  </div>
</template>
LWC — JavaScript
import { LightningElement, api } from 'lwc';

export default class CoinMintButton extends LightningElement {
  @api label = 'Purchase';
  phase = 'idle';
  
  get isAnimating() {
    return this.phase === 'animating';
  }
  
  get buttonText() {
    return this.phase === 'success' ? 'Purchased!' : this.label;
  }
  
  get buttonClass() {
    return `coin-mint-button ${this.phase}`;
  }
  
  handleClick() {
    if (this.phase === 'animating') return;
    this.phase = 'animating';
    
    setTimeout(() => {
      this.phase = 'success';
      setTimeout(() => {
        this.phase = 'idle';
      }, 2000);
    }, 2500);
  }
}
LWC — CSS
.coin-mint-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.coin-mint-button {
  position: relative;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border: none;
  border-radius: 0.75rem;
  color: #1f2937;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.coin-mint-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.coin-mint-button.animating {
  background: linear-gradient(135deg, #fbbf24, #d97706);
}

.coin-mint-button.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.coin-icon { margin-right: 0.5rem; }
.coin-element { position: absolute; border-radius: 50%; opacity: 0; }
.coin-drop { top: -20px; left: 50%; width: 20px; height: 20px; background: #fbbf24; transform: translateX(-50%); animation: coinDrop 0.6s ease-out forwards; }
.coin-spin { top: 50%; left: 50%; width: 30px; height: 30px; background: linear-gradient(135deg, #fbbf24, #d97706); transform: translate(-50%, -50%) scale(0); animation: coinSpin 0.8s ease-in-out 0.6s forwards; }
.coin-stamp { top: 50%; left: 50%; width: 40px; height: 40px; border: 3px solid #059669; background: transparent; transform: translate(-50%, -50%) scale(0); animation: coinStamp 0.4s ease-out 1.4s forwards; }
.golden-shine { top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent); animation: goldenShine 0.8s ease-in-out 1.8s forwards; }
.receipt { bottom: -30px; left: 50%; width: 80%; height: 20px; background: white; border-radius: 0 0 0.5rem 0.5rem; transform: translateX(-50%); animation: receiptAppear 0.5s ease-out 2.2s forwards; }
@keyframes coinDrop { 0% { top: -20px; opacity: 1; } 70% { top: 20px; opacity: 1; } 100% { top: 15px; opacity: 1; } }
@keyframes coinSpin { 0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 1; } 50% { transform: translate(-50%, -50%) scale(1.5) rotate(180deg); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1) rotate(360deg); opacity: 1; } }
@keyframes coinStamp { 0% { transform: translate(-50%, -50%) scale(0); opacity: 1; } 70% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes goldenShine { 0% { left: -100%; opacity: 0; } 50% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes receiptAppear { 0% { bottom: -30px; opacity: 0; } 100% { bottom: -10px; opacity: 1; } }
.coin-mint-button:disabled { opacity: 0.7; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .coin-mint-button.animating .coin-element { animation: none !important; } }
LWC — Configuration
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
  <apiVersion>59.0</apiVersion>
  <isExposed>true</isExposed>
  <targets>
    <target>lightning__AppPage</target>
    <target>lightning__RecordPage</target>
    <target>lightning__HomePage</target>
  </targets>
</LightningComponentBundle>

Where Coin Mint fits

  • E-commerce
  • In-app purchases
  • Subscription upgrades
  • Premium features

Interaction states & animations

  • Coin Drop
  • Spin
  • Stamp
  • Golden Shine
  • Receipt

Topics

  • #coin
  • #mint
  • #purchase
  • #gold
  • #animation
  • #transaction

Accessibility notes

Animation is decorative. Button text remains readable. Respect reduced-motion preference.

Browser support

  • All modern browsers