gsap实现与熊玩开关灯小游戏代码

代码语言:html

所属分类:游戏

代码描述:gsap实现与熊玩开关灯小游戏代码,小熊要睡觉,你拖动开关开灯,熊就很生气

代码标签: 熊玩开 关灯 小游戏

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


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

<head>

  <meta charset="UTF-8">

  
  
<style>
* {
  box-sizing: border-box;
}
:root {
  --depth: 5vmin;
  --on: 0;
  --size: 25vmin;
  --bg: hsl(calc(200 - (var(--on) * 160)), calc((20 + (var(--on) * 50)) * 1%), calc((20 + (var(--on) * 60)) * 1%));
  --cord: hsl(0, 0%, calc((60 - (var(--on) * 50)) * 1%));
  --stroke: hsl(0, 0%, calc((60 - (var(--on) * 50)) * 1%));
  --shine: hsla(0, 0%, 100%, calc(0.75 - (var(--on) * 0.5)));
  --cap: hsl(0, 0%, calc((40 + (var(--on) * 30)) * 1%));
  --filament: hsl(45, calc(var(--on) * 80%), calc((25 + (var(--on) * 75)) * 1%));
}
body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
}
label {
  position: absolute;
  opacity: 0.5;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 2;
}
input {
  height: 0;
  width: 0;
  position: fixed;
  left: 100%;
  transform: scale(0);
}
.toggle {
  height: var(--size);
  width: var(--size);
  transform: translate(-50%, -100%);
  z-index: 2;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -100%, calc(var(--depth) * 3));
}
.toggle-scene {
  overflow: visible !important;
  width: 100%;
  position: absolute;
}
.toggle-scene__arm {
  display: none;
}
.toggle-scene__cord {
  stroke: var(--cord);
  cursor: move;
}
.toggle-scene__cord:nth-of-type(1) {
  display: none;
}
.toggle-scene__cord:nth-of-type(2),
.toggle-scene__cord:nth-of-type(3),
.toggle-scene__cord:nth-of-type(4),
.toggle-scene__cord:nth-of-type(5) {
  display: none;
}
.toggle-scene__cord-end {
  stroke: var(--cord);
  fill: var(--cord);
}
.toggle-scene__dummy-cord {
  stroke-width: 6;
  stroke: var(--cord);
}
.bulb__filament {
  stroke: var(--filament);
}
.bulb__shine {
  stroke: var(--shine);
}
.bulb__flash {
  stroke: #f5e0a3;
  display: none;
}
.bulb__bulb {
  stroke: var(--stroke);
  fill: hsla(calc(180 - (95 * var(--on))), 80%, 80%, calc(0.1 + (0.4 * var(--on))));
}
.bulb__cap {
  fill: var(--cap);
}
.bulb__cap-shine {
  fill: var(--shine);
}
.bulb__cap-outline {
  stroke: var(--stroke);
}
.bear {
  display: none;
}
.bear__fur {
  fill: #784421;
}
.bear__pad {
  fill: #deaa87;
}
.doorway {
  position: absolute;
  top: 50%;
  height: calc(var(--size) * 4);
  width: calc(var(--size) * 1.5);
  transform: translate(0, calc(var(--size) * -0.75));
  left: calc(50% + .........完整代码请登录后点击上方下载按钮下载查看

网友评论0