vue+gsap+howler+lodash实现带声效翻牌扑克牌连连看小游戏代码

代码语言:html

所属分类:游戏

代码描述:vue+gsap+howler+lodash实现带声效翻牌扑克牌连连看小游戏代码,点击两个相同的消失即可。

代码标签: vue gsap howler lodash 声效 翻牌 扑克牌 连连看 游戏

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

<!DOCTYPE html>

<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.9.1.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/howler.2.2.3.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/lodash.4.17.21.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1.js"></script>

    <style>
        @font-face {
            font-family: "CentaurMTPro-Regular";
            src: url('//repo.bfw.wiki/bfwrepo/font/CentaurMTProRegular.woff2') format('woff2'), 
                 url('//repo.bfw.wiki/bfwrepo/font/CentaurMTProRegular.woff') format('woff');
          }
          
          html, body, #app, #game{
            height: 100%;
            width: 100%;
          }
          
          body{
            background: black;
            color: #FFF;
            font-family: CentaurMTPro-Regular, serif;
            letter-spacing: 2px;
            text-transform: uppercase;
          }
          
          #game{
            background: black;
            border: 2px solid #DCC48C;
            box-sizing: border-box;
            display: grid;
            grid-template-rows: 1fr auto 1fr;
          }
          
          header, footer{
            align-items: center;
            display: flex;
            left: 0;
            justify-content: center;    
            width: 100%;
          }
          
          header{
            color: #7E4015;
            flex-direction: column;
          }
          
          header img{
            height: 18px;
            margin-bottom: 12px;
          }
          
          section{
            align-items: center;
            display: flex;
            justify-content: center;
          }
          
          article{    
            max-width: 55vw;
            width: 100%;
          }  
          
          #cards{
            box-sizing: border-box;
            display: grid;
            gap: 12px;
            grid-template-columns: repeat(7, 1fr);
            grid-template-rows: repeat(4, 1fr);
          }
          
          .card{
            appearance: none;
            aspect-ratio: 200 / 236;
            cursor: pointer;
            position: relative;
            transform-style: preserve-3d;
            width: 100%;
          }
          
          .card.disabled{
            pointer-events: none;
          }
          
          @media (hover: hover) {
            .card:not(.disabled):hover .face.back{
              box-shadow: 0 0 0 2px black, 0 0 0 4px white;
            }
          }
          
          .face{
            backface-visibility: hidden;
            -webkit-backface-visibility: hidden;
            border-radius: 8%;
            height: 100%;
            position: absolute;
            width: 100%;
          }
          
          .front{
            background-size: cover;
            transform: rotateY(180deg);
          }
          
          .back{
            background-image: url(//repo.bfw.wiki/bfwrepo/images/game/fanpai/dance-fever-back.jpg);
            background-size: cover;
          }
          
          @media (max-width: 480px) {
            article{
              max-width: none;
              width: 55%;
            }
            
            #cards{
              gap: 6px;
              grid-template-columns: repeat(4, 1fr);
              grid-template-rows: repeat(7, 1fr);
            }
          }
    </style>
</head>

<body>
    <div id="app">

        <div id="game">
            <header>
                <img src="//repo.bfw.wiki/bfwrepo/images/game/fanpai/dance-fever.png" alt="Dance Fever" />
                <div>Concentration</div>
            </header>

            <section>
                <article>
                    <div id="cards" v-if="cards.length">
                        <div v-for="(card, i) in cards" :key="card" :class="['car.........完整代码请登录后点击上方下载按钮下载查看

网友评论0