js+css实现一个扑克牌deck游戏代码

代码语言:html

所属分类:游戏

代码描述:js+css实现一个扑克牌deck游戏代码,有洗牌动画。

代码标签: js css 扑克 deck 游戏 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/normalize.css">
  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Noto+Color+Emoji&display=swap");

:root {
  /* Card properties */
  --card-width: 100px;
  --card-height: 140px;
  --card-border-radius: 10px;
  --card-border: 2px solid #1a1a1a;
  --card-bg: white;
  --card-shadow: 2px 2px 8px rgba(0, 0, 0, 0.25);
  --card-font: "Arial";
  --card-transition: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* 3D properties */
  --deck-perspective: 2000px;
  --hover-scale: 1.1;
  --hover-rotate-y: 5deg;
  --hover-rotate-x: -5deg;
  --hover-z: 50px;
  --hover-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
  --spread-distance: 250px;
  --spread-angle: 60deg;
  
  /* Font sizes */
  --corner-font-size: 16px;
  --center-font-size: 24px;
  --face-font-size: 48px;
  
  /* Color palette - classic casino */
  --bg-color: #0c3b2e;
  --bg-gradient: linear-gradient(135deg, #0c3b2e 0%, #145a44 100%);
  --text-color: #f8f0e3;
  --accent-color: #d4af37;
  --accent-light: #f2d675;
  --button-bg: rgba(212, 175, 55, 0.85);
  --button-hover: rgba(212, 175, 55, 1);
  --button-border: 1px solid #b4922c;
  --header-bg: rgba(26, 26, 26, 0.9);
  --footer-bg: rgba(26, 26, 26, 0.9);
  --deck-bg: rgba(20, 90, 68, 0.7);
  
  /* Texture URLs */
 /* --felt-texture: url('https://www.transparenttextures.com/patterns/felt.png');
  --card-texture: url('https://www.transparenttextures.com/patterns/cardboard-flat.png');*/
}

/* Base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg-color);
  background-image: var(--bg-gradient), var(--felt-texture);
  font-family: "Playfair Display", serif;
  font-weight: 400;
  font-style: normal;
  min-height: 100vh;
  color: var(--text-color);
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header"
    "main"
    "footer";
}

span {
  font-family: "Noto Color Emoji", sans-serif;
  font-weight: 400;
  font-style: normal;
}

/* Header styles - classic casino */
header {
  grid-area: header;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--header-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--accent-color);
}

h1 {
  font-size: 2.5rem;
  color: var(--accent-color);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  font-family: "Playfair Display", serif;
  letter-spacing: 1px;
  font-weight: 700;
}

nav {
  display: flex;
  gap: 1rem;
}

/* Main content - classic casino */
main {
  grid-area: main;
  display: grid;
  place-items: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

main::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4af37' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.2;
  z-index: -1;
}

.deck-container {
  width: 100%;
  max-width: 1200px;
  height: 70vh;
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  place-items: center;
  position: relative;
  overflow: visible;
}

/* Table decorations */
.table-decoration {
  width: 60px;
  height: 60px;
  bord.........完整代码请登录后点击上方下载按钮下载查看

网友评论0