react实现一个比眼力小游戏代码
代码语言:html
所属分类:游戏
代码描述:react实现一个比眼力小游戏代码,对于四类特征(颜色、数字、形状和底纹)中的每一种,这三个小饰物必须显示为a)要么完全相同,要么b)全部不同。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; background-color: #c9daea; } a, a:visited { color: inherit; } p { margin: 10px 0 16px 0; color: inherit; color: white; } b { font-weight: normal; } svg { animation-name: appear; animation-duration: 1.5s; animation-iteration-count: 1; } @keyframes appear { 0% { opacity: 0; } 100% { opacity: 1; } } .container { display: flex; flex-direction: row; justify-content: center; align-items: center; height: 100vh; padding } .sidebar { display: flex; flex-direction: column; width: 240px; background-color: #626c66; color: white; padding: 20px; border-radius: 10px; font-size: 0.8em; margin: 20px 20px 20px 0; } button { padding: 15px; font-size: 1em; background-color: #ef5169; border: none; border-radius: 5px; color: white; cursor: pointer; } .score { text-align: center; font-weight: bold; font-size: 1.5em; } .grid { margin: 20px; padding: 15px; display: grid; grid-template-columns: repeat(4, minmax(auto, 120px)); grid-template-rows: repeat(3, minmax(auto, 120px)); gap: 10px; background-color: white; border-radius: 10px; height: 80vh; } .bauble { border-radius: 10px; box-sizing: border-box; width: 100%; height: 100%; } .less-important { display: none; } @media (min-width: 980px) and (min-height: 480px) { .grid { height: auto; } .bauble { width: 150px; height: 150px; } .sidebar { font-size: 1em; } .less-important { display: block; } } .grid.game .bauble:hover { background-color: #f0f6ff; cursor: pointer; } .bauble.selected { background-color: #f0f6ff; border: 3px solid #c3d9fa; } .grid.time-up .bauble.selected { background-color: #fffccf; border: 3px solid #ede105; } .grid.failed .bauble.selected { background-color: #ffe6e6; border: 3px solid #ff0d0d; } .result { text-align: center; } .twitter { text-align: center; margin: 20px 0 20px 0; } #youtube, #youtube-card { display: none; } @media (min-height: 425px) { /** Youtube logo by https://codepen.io/alvaromontoro */ #youtube { z-index: 50; width: 100px; display: block; height: 70px; position: fixed; bottom: 20px; right: 20px; background: red; border-radius: 50% / 11%; transform: scale(0.8); transition: transform 0.5s; } #youtube:hover, #youtube:focus { transform: scale(0.9); } #youtube::before { content: ""; display: block; position: absolute; top: 7.5%; left: -6%; width: 112%; height: 85%; background: red; border-radius: 9% / 50%; } #youtube::after { content: ""; display: block; position: absolute; top: 20px; left: 40px; width: 45px; height: 30px; border: 15px solid transparent; box-sizing: border-box; border-left: 30px solid white; } #youtube span { font-size: 0; position: absolute; width: 0; height: 0; overflow: hidden; } #youtube:hov.........完整代码请登录后点击上方下载按钮下载查看
网友评论0