js+css实现逼真的石头剪刀布游戏代码
代码语言:html
所属分类:游戏
代码描述:js+css实现逼真的石头剪刀布游戏代码,规则:你与电脑对战,电脑会随机选择石头、剪刀或布。 每场比赛开始时,你的手势会被随机设定。 点击指纹来伸展或收回相应的指头。 排列手指以形成石头、剪刀或布。 你有有限的时间来做出选择。 当你输掉比赛或展示无效手势时,你的分数会重置。 你的分数越高,你做出选择的时间就越少。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { background-color: black; height: 100vh; margin: 0; display: flex; flex-direction: column; color: white; font-family: Arial; position: relative; } .handWrapper { flex: 1; display: flex; justify-content: center; } .hand { aspect-ratio: 0.8; background-image: url(//repo.bfw.wiki/bfwrepo/images/hand/combined.png); background-size: auto 3200%; position: relative; height: 100%; } #opponent .hand { transform: rotate(180deg); } .fingerprint { display: none; background-image: url("//repo.bfw.wiki/bfwrepo/images/hand/fingerprint.png"); aspect-ratio: 1; width: 10%; position: absolute; filter: invert(1); background-size: contain; opacity: 0.7; cursor: pointer; } .fingerprint#thumb { top: 41%; left: 81%; } .fingerprint#index { top: 10%; left: 57%; } .fingerprint#middle { top: 5%; left: 44%; } .fingerprint#ring { top: 9%; left: 31%; } .fingerprint#pinky { top: 19%; left: 13%; } [data-state=Playing] .fingerprint { display: block; } #timer { display: none; position: absolute; top: 0; right: 0; margin: 22px; width: 80px; height: 80px; transform: rotate(-90deg); } [data-state=Playing] #timer { display: block; } [data-state=Playing] #timer circle { stroke-dasharray: 226px; stroke-dashoffset: 0px; stroke-width: 8px; stroke: white; fill: none; animation-nam.........完整代码请登录后点击上方下载按钮下载查看
网友评论0