Skip to content

Castle Gate

Heavy castle gates swing open to reveal a glowing welcome — then slowly close back

Castle Gate

by FreeCsStyles Dev's

AnimatedMedieval
🌐🎨⚛️💚🅰️🔥☁️
#castle#gate#medieval#login#door#welcome#knight#fantasy

Embed this component

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

<iframe src="/embed/castle-gate" sandbox="allow-scripts" loading="lazy" title="Castle Gate" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

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

HTML
<button class="btn-castle"><div class="glow">Welcome</div><div class="gate left"></div><div class="gate right"></div><span class="text">Login</span></button>
CSS
.btn-castle{width:160px;height:50px;border-radius:12px;border:2px solid #334155;background:#000;color:#fff;font-size:16px;font-weight:700;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:all .4s;font-family:system-ui,sans-serif}.btn-castle .gate{position:absolute;top:0;width:50%;height:100%;background:repeating-linear-gradient(90deg,#475569,#475569 10px,#334155 10px,#334155 12px);transition:transform 1s cubic-bezier(.5,0,.2,1);z-index:2}.btn-castle .gate.left{left:0;border-right:1px solid #1e293b;transform-origin:left}.btn-castle .gate.right{right:0;border-left:1px solid #1e293b;transform-origin:right}.btn-castle .glow{position:absolute;width:100%;height:100%;background:radial-gradient(circle,#fef08a,#ca8a04);opacity:0;z-index:1;transition:1s;display:flex;justify-content:center;align-items:center;color:black}.btn-castle .text{z-index:3}.btn-castle.is-opening .text{opacity:0}.btn-castle.is-opening .gate.left{transform:scaleX(0)}.btn-castle.is-opening .gate.right{transform:scaleX(0)}.btn-castle.is-opening .glow{opacity:1}
Tailwind CSS
<button class="w-[160px] h-[50px] rounded-xl border-2 border-slate-700 bg-black text-white font-bold cursor-pointer relative flex items-center justify-center overflow-hidden transition-all duration-[400ms] font-sans"><span class="relative z-10">🏰 Login</span></button>
React
import { useState } from 'react';
export function CastleGate() {
  const [phase, setPhase] = useState('idle');
  const handleClick = () => {
    if (phase !== 'idle') return;
    setPhase('opening');
    setTimeout(() => setPhase('idle'), 3500);
  };
  return (
    <button onClick={handleClick} disabled={phase !== 'idle'}
      style={{ width: 160, height: 50, borderRadius: 12, border: '2px solid #334155', background: '#000', color: '#fff', fontSize: 16, fontWeight: 'bold', cursor: 'pointer', position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center', overflow: 'hidden', fontFamily: 'system-ui,sans-serif', transition: 'all 0.4s' }}>
      <span>{phase === 'idle' ? '🏰 Login' : ''}</span>
    </button>
  );
}
Vue
<template>
  <button class="btn-castle" :class="phase" @click="handleClick" :disabled="phase!=='idle'">
    <div class="glow">Welcome</div>
    <div class="gate left"></div>
    <div class="gate right"></div>
    <span class="text">{{ phase==='idle' ? 'Login' : '' }}</span>
  </button>
</template>
<script setup>
import { ref } from 'vue';
const phase = ref('idle');
function handleClick() {
  if (phase.value !== 'idle') return;
  phase.value = 'opening';
  setTimeout(() => phase.value = 'idle', 3500);
}
</script>
Svelte
<script>
  let phase = 'idle';
  function handleClick() { if (phase !== 'idle') return; phase = 'opening'; setTimeout(() => phase = 'idle', 3500); }
</script>
<button class="btn-castle" class:is-opening={phase==='opening'} on:click={handleClick} disabled={phase!=='idle'}>
  <div class="glow">Welcome</div>
  <div class="gate left"></div>
  <div class="gate right"></div>
  <span class="text">{phase==='idle' ? 'Login' : ''}</span>
</button>
Angular
import { Component } from '@angular/core';
@Component({
  selector: 'app-castle-gate',
  template: `<button class="btn-castle" [class.is-opening]="phase==='opening'" (click)="handleClick()" [disabled]="phase!=='idle'"><div class="glow">Welcome</div><div class="gate left"></div><div class="gate right"></div><span class="text">{{ phase==='idle' ? 'Login' : '' }}</span></button>`,
  styles: [`.btn-castle{width:160px;height:50px;border-radius:12px;border:2px solid #334155;background:#000;color:#fff;font-size:16px;font-weight:700;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden}`]
})
export class CastleGateComponent { phase='idle';handleClick(){if(this.phase!=='idle')return;this.phase='opening';setTimeout(()=>this.phase='idle',3500);}}
LWC — HTML template
<template><button class="btn-castle" onclick={handleClick} disabled={disabled}><span>{label}</span></button></template>
LWC — JavaScript
import { LightningElement } from 'lwc';
export default class CastleGate extends LightningElement {
  phase = 'idle';
  get disabled() { return this.phase !== 'idle'; }
  get label() { return this.phase==='idle'?'🏰 Login':''; }
  handleClick() { if(this.phase!=='idle')return;this.phase='opening';setTimeout(()=>this.phase='idle',3500); }
}
LWC — CSS
.btn-castle{width:160px;height:50px;border-radius:12px;border:2px solid #334155;background:#000;color:#fff;font-size:16px;font-weight:700;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:all .4s}
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 Castle Gate fits

  • Login Actions
  • Authentication
  • Entry
  • Welcome
  • Gated Content

Interaction states & animations

  • Gate Open
  • Glow Reveal
  • Castle Door

Topics

  • #castle
  • #gate
  • #medieval
  • #login
  • #door
  • #welcome
  • #knight
  • #fantasy

Accessibility notes

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

Browser support

  • All modern browsers