gsap实现石头剪刀布游戏代码
代码语言:html
所属分类:游戏
代码描述:gsap实现石头剪刀布游戏代码,点击开始和电脑玩游戏,看谁出的厉害。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> @import url("https://fonts.googleapis.com/css2?family=Roboto:wght@700&display=swap"); html, body { width: 100%; height: 100%; overflow: hidden; font-family: "Roboto", sans-serif; color: #fff; } .tray { height: 100%; width: 100%; background: #000; display: flex; justify-content: center; align-items: center; } .result { font-size: 98px; width: 100px; text-align: center; padding-top: 9px; opacity: 0; } @media (orientation: portrait) { .tray { flex-direction: column; } } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { .tray { transform: scale(50%); transform-origin: top left; width: 200%; height: 200%; } } .die { width: 300px; height: 300px; perspective: 999px; } .cube { position: absolute; width: 300px; height: 300px; transform-style: preserve-3d; z: -600px; } .face { position: absolute; user-select: none; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #fff; font-size: 190px; backface-visibility: hidden; border-radius: 12px; padding: 2px; } </style> </head> <body translate="no"> <div class="tray"> <div class="die"> <div class="cube"> <div class="face"></div> <div class="face"></div> <div class="face"></div> <div class="face"></div> <div class="face"></div> <div class="face"></div> </div> </div> <div class="result">2</div> <!-- cloned die will go here --> </div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.12.2.js"></script> <script > const rots = [ { ry: 0, rx: 0 }, { ry: 90, rx: 0 }, { ry: 180, rx: 0 }, { ry: 270, rx: 0 }, { ry: 0, rx: 90 }, { ry: 0, rx: -90 }], emojis = [.........完整代码请登录后点击上方下载按钮下载查看
网友评论0