svg+js实现刮刮卡刮开开奖效果代码

代码语言:html

所属分类:其他

代码描述:svg+js实现刮刮卡刮开开奖效果代码

代码标签: svg js 刮刮卡 刮开 开奖

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

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

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
@charset "UTF-8";
@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&display=swap");
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  background: linear-gradient(#fff -100%, #888);
  font-family: "Arial Black", "Archivo Black", sans-serif;
  overflow: hidden;
  cursor: none;
}

.scratch-win {
  position: relative;
  padding: 1rem 2rem 2rem 2rem;
  background: linear-gradient(#78d6c6 -150%, #12486b);
  border: 0.2rem solid #ffdc73;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0.2rem 0.2rem 1rem 0 rgba(0, 0, 56, 0.3);
}
@media screen and (max-width: 500px) {
  .scratch-win {
    padding-left: 0;
    padding-right: 0;
  }
  .scratch-win__coin {
    transform: scale(0.8);
  }
}
.scratch-win:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(-70deg, transparent, transparent 50%, rgba(255, 255, 255, 0.1) 57%, transparent 60%);
  background-size: 300% 100%;
  animation: shinning;
  animation-duration: 6s;
  animation-iteration-count: infinite;
  pointer-events: none;
}
@keyframes shinning {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 100% 0;
  }
}
.scratch-win__title {
  width: 100%;
  margin: 0 auto 1rem;
  color: #ffdc73;
  font-size: 2rem;
  text-align: center;
  text-transform: uppercase;
  background: -webkit-linear-gradient(#ffdc73, #a67c00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.scratch-win__scratcher {
  position: relative;
  width: 20rem;
  height: 10rem;
}
.scratch-win__background, .scratch-win__foreground {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.scratch-win__background {
  display: flex;
  justify-content: center;
  align-items: center;
  color: #888;
  background-color: #fff;
  text-transform: uppercase;
  font-size: 3.6rem;
}
.scratch-win__background:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(transparent, transparent 0.5rem, #888 0.5rem, #888 0.6rem);
  opacity: 0.5;
}
.scratch-win__coin {
  position: absolute;
  z-index: 2;
  top: calc(var(--top) - 5rem);
  left: calc(var(--left) - 3rem);
  width: 6rem;
  height: 6rem;
  pointer-events: none;
}
.scratch-win__coin-side {
  position: absolute;
  top: -0.4rem;
  left: 0;
  z-index: -1;
  width: calc(100% + 0.6rem);
  height: calc(100% + 0.6rem);
  border-radius: 50%;
  outline: 0.1rem solid #a67c00;
  background: repeating-linear-gradient(90deg, #d4af37 0, #d4af37 0.5rem, #ffdc73 0.5rem, #ffdc73 0.7rem);
  box-shadow: 0 1rem 1rem -0.5rem rgba(0, 0, 56, 0.5);
}
@supports (-webkit-hyphens: none) {
  .scratch-win__coin-side {
    outline: none;
  }
}
.scratch-win__coin-base {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0.3rem dashed #d4af37;
  outline: 0.1rem solid #a67c00;
  border-radius: 50%;
  background: radial-gradient(circle at 0 0, #ffdc73, #d4af37 150%);
  box-shadow: inset 0 -0.1rem 0 0 #a67c00;
}
@supports (-webkit-hyphens: none) {
  .scratch-win__coin-base {
    outline: none;
  }
}
.scratch-win__coin-base:before, .scratch-win__coin-base:after {
  content: "€";
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  font-size: 4rem;
}
.scratch-win__coin-base:before {
  color: #a67c00;
  transform: rotate(45deg) translateX(-0.4rem) translateY(-0.25rem);
}
.scratch-win__coin-base:after {
  color: #d4af37;
  transform: rotate(45deg) translateX(-0.3rem) translateY(-0.2rem);
  background: -webkit-linear-gradient(#ffdc73 -50%, #d4af37);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.confetti {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 100%;
  height: 200%;
  pointer-events: none;
  --top-position: -300vh;
}
.confetti__item {
  position: absolute;
  box-shadow: 1rem 1rem 1rem 0 rgba(0, 0, 56, 0.5);
}
.confetti__item:nth-child(1) {
  top: calc(0.4114539596 * 150% + var(--top-position));
  left: calc(0.7400943158 * 100%);
  transform: scale(max(4.1799926808, 2)) rotate(64.8418324212deg);
}
.confetti__item:nth-child(2) {
  top: calc(0.888408001 * 150% + var(--top-position));
  left: calc(0.6774079553 * 100%);
  transform: scale(max(4.0196940391, 2)) rotate(26.8728179646deg);
}
.confetti__item:nth-child(3) {
  top: calc(0.0682460432 * 150% + var(--top-position));
  left: calc(0.3122977004 * 100%);
  transform: scale(max(2.2570223664, 2)) rotate(41.417988051deg);
}
.confetti__item:nth-child(4) {
  top: calc(0.8234272568 * 150% + var(--top-position));
  left: calc(0.1280570143 * 100%);
  transform: scale(max(0.2140426471, 2)) rotate(48.1123456086deg);
}
.confetti__item:nth-child(5) {
  top: calc(0.3823604915 * 150% + var(--top-position));
  left: calc(0.8681486002 * 100%);
  transform: scale(max(1.6585784667, 2)) rotate(47.9074883173deg);
}
.confetti__item:nth-child(6) {
  top: calc(0.3103658294 * 150% + var(--top-position));
  left: calc(0.5658989961 * 100%);
  transform: scale(max(4.581095104, 2)) rotate(4.440938451deg);
}
.confetti__item:nth-child(7) {
  top: calc(0.2870089288 * 150% + var(--top-position));
  left: calc(0.7838554618 * 100%);
  transform: scale(max(4.4963690077, 2)) rotate(15.6622231873deg);
}
.confetti__item:nth-child(8) {
  top: calc(0.0845872813 * 150% + var(--top-position));
  left: calc(0.4534077455 * 100%);
  transform: scale(max(3.0381822452, 2)) rotate(42.8676394097deg);
}
.confetti__item:nth-child(9) {
  top: calc(0.8564763809 * 150% + var(--top-position));
  left: calc(0.9132466429 * 100%);
  transform: scale(max(2.0057990128, 2)) rotate(52.228114585deg);
}
.confetti__item:nth-child(10) {
  top: calc(0.9637571565 * 150% + var(--top-position));
  left: calc(0.3346799927 * 100%);
  transform: scale(max(4.2713811846, 2)) rotate(69.5041067906deg);
}
.confetti__item:nth-child(11) {
  top: calc(0.4655966453 * 150% + var(--top-position));
  left: calc(0.700736173 * 100%);
  transform: scale(max(4.5262665393, 2)) rotate(26.1416579164deg);
}
.confetti__item:nth-child(12) {
  top: calc(0.947117155 * 150% + var(--top-position));
  left: calc(0.6037146156 * 100%);
  transform: scale(max(4.3112407352, 2)) rotate(35.9030427115deg);
}
.confetti__item:nth-child(13) {
  top: calc(0.7392164231 * 150% + var(--top-position));
  left: calc(0.1492563051 * 100%);
  transform: scale(max(3.0969220529, 2)) rotate(87.7780500506deg);
}
.confetti__item:nth-child(14) {
  top: calc(0.5781295169 * 150% + var(--top-position));
  left: calc(0.9725232148 * 100%);
  transform: scale(max(3.8126693288, 2)) rotate(15.1612944526deg);
}
.confetti__item:nth-child(15) {
  top: calc(0.5859975874 * 150% + var(--top-position));
  left: calc(0.863297893 * 100%);
  transform: scale(max(1.381214889, 2)) rotate(15.2841355991deg);
}
.confetti__item:nth-child(16) {
  top: calc(0.8598121212 * 150% + var(--top-position));
  left: calc(0.264588188 * 100%);
  transform: scale(max(2.1064166698, 2)) rotate(51.0874527827deg);
}
.confetti__item:nth-child(17) {
  top: calc(0.7894518232 * 150% + var(--top-position));
  left: calc(0.9213129994 * 100%);
  transform: scale(max(2.4458422441, 2)) rotate(3.4857196706deg);
}
.confetti__item:nth-child(18) {
  top: calc(0.4516904841 * 150% + var(--top-position));
  left: calc(0.2997635756 * 100%);
  transform: scale(max(2.0458056583, 2)) rotate(82.4356964334deg);
}
.confetti__item:nth-child(19) {
  top: calc(0.177866577 * 150% + var(--top-position));
  left: calc(0.7840049184 * 100%);
  transform: scale(max(1.9121012205, 2)) rotate(88.3402954171deg);
}
.confetti__item:nth-child(20) {
  top: calc(0.1773520969 * 150% + var(--top-position));
  left: calc(0.4421949873 * 100%);
  transform: scale(max(0.0185867321, 2)) rotate(10.738518134deg);
}
.confetti__item:nth-child(21) {
  top: calc(0.764347628 * 150% + var(--top-position));
  left: calc(0.5754837932 * 100%);
  transform: scale(max(1.1855747837, 2)) rotate(75.4968288742deg);
}
.confetti__item:nth-child(22) {
  top: calc(0.4035664244 * 150% + var(--top-position));
  left: calc(0.1653152999 * 100%);
  transform: scale(max(1.8980378941, 2)) rotate(76.4210976806deg);
}
.confetti__item:nth-child(23) {
  top: calc(0.9834270728 * 150% + var(--top-position));
  left: calc(0.3475365805 * 100%);
  transform: scale(max(3.7179995268, 2)) rotate(37.9903315009deg);
}
.confetti__item:nth-child(24) {
  top: calc(0.1877533237 * 150% + var(--top-position));
  left: calc(0.7196316117 * 100%);
  transform: scale(max(3.3752746251, 2)) rotate(57.1472923902deg);
}
.confetti__item:nth-child(25) {
  top: calc(0.565366686 * 150% + var(--top-position));
  left: calc(0.081553975 * 100%);
  transform: scale(max(1.7267285944, 2)) rotate(73.0346365129deg);
}
.confetti__item:nth-child(26) {
  top: calc(0.1648152412 * 150% + var(--top-position));
  left: calc(0.4462902512 * 100%);
  transform: scale(max(4.4055662907, 2)) rotate(78.38630642deg);
}
.confetti__item:nth-child(27) {
  top: calc(0.0483208545 * 150% + var(--top-position));
  left: calc(0.7202652338 * 100%);
  transform: scale(max(4.5406665566, 2)) rotate(87.1939658048deg);
}
.confetti__item:nth-child(28) {
  top: calc(0.7854306976 * 150% + var(--top-position));
  left: calc(0.4532644498 * 100%);
  transform: scale(max(0.5310652548, 2)) rotate(48.9873278508deg);
}
.confetti__item:nth-child(29) {
  top: calc(0.4010696648 * 150% + var(--top-position));
  left: calc(0.1980555691 * 100%);
  transform: scale(max(1.8288731802, 2)) rotate(32.557899728deg);
}
.confetti__item:nth-child(30) {
  top: calc(0.5764537119 * 150% + var(--top-position));
  left: calc(0.4943771444 * 100%);
  transform: scale(max(3.4305073384, 2)) rotate(39.908455192deg);
}
.confetti__item:nth-child(31) {
  top: calc(0.4659884304 * 150% + var(--top-position));
  left: calc(0.286460759 * 100%);
  transform: scale(max(4.4991116791, 2)) rotate(11.3045084868deg);
}
.confetti__item:nth-child(32) {
  top: calc(0.2833625561 * 150% + var(--top-position));
  left: calc(0.4867896527 * 100%);
  transform: scale(max(1.8047186184, 2)) rotate(17.4535424835deg);
}
.confetti__item:nth-child(33) {
  top: calc(0.3327239366 * 150% + var(--top-position));
  left: calc(0.8689345303 * 100%);
  transform: scale(max(4.8736485533, 2)) rotate(44.153037283deg);
}
.confetti__item:nth-child(34) {
  top: calc(0.8037270268 * 150% + var(--top-position));
  left: calc(0.5471477373 * 100%);
  transform: scale(max(0.7151743148, 2)) rotate(5.2842484597deg);
}
.confetti__item:nth-child(35) {
  top: calc(0.9157940833 * 150% + var(--top-position));
  left: calc(0.9681993603 * 100%);
  transform: scale(max(3.4521553978, 2)) rotate(49.684175386deg);
}
.confetti__item:nth-child(36) {
  top: calc(0.8249184283 * 150% + var(--top-position));
  left: calc(0.1052741483 * 100%);
  transform: scale(max(3.7279167562, 2)) rotate(72.7355048111deg);
}
.confetti__item:nth-child(37) {
  top: calc(0.9671305931 * 150% + var(--top-position));
  left: calc(0.2588138146 * 100%);
  transform: scale(max(2.9442221751, 2)) rotate(38.9382521685deg);
}
.confetti__item:nth-child(38) {
  top: calc(0.2640178222 * 150% + var(--top-position));
  left: calc(0.7720015781 * 100%);
  transform: scale(max(0.7750956006, 2)) rotate(67.7867617915deg);
}
.confetti__item:nth-child(39) {
  top: calc(0.4104434786 * 150% + var(--top-position));
  left: calc(0.0404951293 * 100%);
  transform: scale(max(3.9167807525, 2)) rotate(45.5504350248deg);
}
.confetti__item:nth-child(40) {
  top: calc(0.4284134034 * 150% + var(--top-position));
  left: calc(0.4675410232 * 100%);
  transform: scale(max(1.3185288609, 2)) rotate(16.2425147465deg);
}
.confetti__item:nth-child(41) {
  top: calc(0.8618966366 * 150% + var(--top-position));
  left: calc(0.8910525634 * 100%);
  transform: scale(max(4.6329288686, 2)) rotate(18.8927318215deg);
}
.confetti__item:nth-child(42) {
  top: calc(0.1297297621 * 150% + var(--top-position));
  left: calc(0.7283710057 * 100%);
  transform: scale(max(2.5289565935, 2)) rotate(51.9226061491deg);
}
.confetti__item:nth-child(43) {
  top: calc(0.3652413178 * 150% + var(--top-position));
  left: calc(0.8253215491 * 100%);
  transform: scale(max(4.4040175893, 2)) rotate(9.0769511977deg);
}
.confetti__item:nth-child(44) {
  top: calc(0.4880836639 * 150% + var(--top-position));
  left: calc(0.9597731746 * 100%);
  transform: scale(max(3.9152045576, 2)) rotate(89.1158232399deg);
}
.confetti__item:nth-child(45) {
  top: calc(0.3061458205 * 150% + var(--top-position));
  left: calc(0.7446268759 * 100%);
  transform: scale(max(3.6525161838, 2)) rotate(14.0244140769deg);
}
.confetti__item:nth-child(46) {
  top: calc(0.1138241423 * 150% + var(--top-position));
  left: calc(0.3721093875 * 100%);
  transform: scale(max(1.2614089319, 2)) rotate(13.2107830626deg);
}
.confetti__item:nth-child(47) {
  top: calc(0.6799809435 * 150% + var(--top-position));
  left: calc(0.0484899772 * 100%);
  transform: scale(max(0.2077899334, 2)) rotate(11.8001763625deg);
}
.confetti__item:nth-child(48) {
  top: calc(0.7465100544 * 150% + var(--top-position));
  left: calc(0.2694986421 * 100%);
  transform: scale(max(0.7502763514, 2)) rotate(55.2667021601deg);
}
.confetti__item:nth-child(49) {
  top: calc(0.0125775598 * 150% + var(--top-position));
  left: calc(0.106428775 * 100%);
  transform: scale(max(4.6592610854, 2)) rotate(53.8157174812deg);
}
.confetti__item:nth-child(50) {
  top: calc(0.6909556569 * 150% + var(--top-position));
  left: calc(0.38273386 * 100%);
  transform: scale(max(2.9295362646, 2)) rotate(5.3083060125deg);
}
.confetti__item:nth-child(51) {
  top: calc(0.4743668131 * 150% + var(--top-position));
  left: calc(0.9163130552 * 100%);
  transform: scale(max(1.9466817013, 2)) rotate(84.829778951deg);
}
.confetti__item:nth-child(52) {
  top: calc(0.3677404316 * 150% + var(--top-position));
  left: calc(0.0488022601 * 100%);
  transform: scale(max(4.6290473625, 2)) rotate(4.3644038857deg);
}
.confetti__item:nth-child(53) {
  top: calc(0.4498783201 * 150% + var(--top-position));
  left: calc(0.6614189734 * 100%);
  transform: scale(max(1.1789649123, 2)) rotate(62.9691712123deg);
}
.confetti__item:nth-child(54) {
  top: calc(0.7702869753 * 150% + var(--top-position));
  left: calc(0.1134058768 * 100%);
  transform: scale(max(4.6840221992, 2)) rotate(85.7207930523deg);
}
.confetti__item:nth-child(55) {
  top: calc(0.6315910249 * 150% + var(--top-position));
  left: calc(0.535784539 * 100%);
  transform: scale(max(0.6258064707, 2)) rotate(9.7758868819deg);
}
.confetti__item:nth-child(56) {
  top: calc(0.324669103 * 150% + var(--top-position));
  left: calc(0.3344880243 * 100%);
  transform: scale(max(4.5194231762, 2)) rotate(1.414540321deg);
}
.confetti__item:nth-child(57) {
  top: calc(0.2241832012 * 150% + var(--top-position));
  left: calc(0.2413841022 * 100%);
  transform: scale(max(4.3088131216, 2)) rotate(61.5517005342deg);
}
.confetti__item:nth-child(58) {
  top: calc(0.0253332272 * 150% + var(--top-position));
  left: calc(0.1314466309 * 100%);
  transform: scale(max(1.8675836741, 2)) rotate(68.3616729019deg);
}
.confetti__item:nth-child(59) {
  top: calc(0.4985474802 * 150% + var(--top-position));
  left: calc(0.5478643921 * 100%);
  transform: scale(max(4.2660249247, 2)) rotate(5.7852381159deg);
}
.confetti__item:nth-child(60) {
  top: calc(0.4838584615 * 150% + var(--top-position));
  left: calc(0.5295218705 * 100%);
  transform: scale(max(0.1139300911, 2)) rotate(15.5840815524deg);
}
.confetti__item:nth-child(61) {
  top: calc(0.156571676 * 150% + var(--top-position));
  left: calc(0.9620925268 * 100%);
  transform: scale(max(2.1579943228, 2)) rotate(77.60242511deg);
}
.confetti__item:nth-child(62) {
  top: calc(0.5713727676 * 150% + var(--top-position));
  left: calc(0.5965864553 * 100%);
  transform: scale(max(4.4842242809, 2)) rotate(76.4179548997deg);
}
.confetti__item:nth-child(63) {
  top: calc(0.0263386111 * 150% + var(--top-position));
  left: calc(0.0216206884 * 100%);
  transform: scale(max(4.3752741143, 2)) rotate(76.2389077611deg);
}
.confetti__item:nth-child(64) {
  top: calc(0.9660644667 * 150% + var(--top-position));
  left: calc(0.370131996 * 100%);
  transform: scale(max(2.7022857307, 2)) rotate(29.0852471774deg);
}
.confetti__item:nth-child(65) {
  top: calc(0.4514357945 * 150% + var(--top-position));
  left: calc(0.5729692768 * 100%);
  transform: scale(max(3.2200618225, 2)) rotate(60.5761199266deg);
}
.confetti__item:nth-child(66) {
  top: calc(0.4224442855 * 150% + var(--top-position));
  left: calc(0.8091690936 * 100%);
  transform: scale(max(0.0753585269, 2)) rotate(79.8054727165deg);
}
.confetti__item:nth-child(67) {
  top: calc(0.802541431 * 150% + var(--top-position));
  left: calc(0.3395652099 * 100%);
  transform: scale(max(4.9982210353, 2)) rotate(74.5973770641deg);
}
.confetti__item:nth-child(68) {
  top: calc(0.7539362203 * 150% + var(--top-position));
  left: calc(0.981071936 * 100%);
  transform: scale(max(4.1966855083, 2)) rotate(17.1295965056deg);
}
.confetti__item:nth-child(69) {
  top: calc(0.8954659521 * 150% + var(--top-position));
  left: calc(0.5253214265 * 100%);
  transform: scale(max(3.5484557387, 2)) rotate(64.5961109794deg);
}
.confetti__item:nth-child(70) {
  top: calc(0.7897400369 * 150% + var(--top-position));
  left: calc(0.1618372554 * 100%);
  transform: scale(max(0.8266918572, 2)) rotate(82.8753437694deg);
}
.confetti__item:nth-child(71) {
  top: calc(0.0161652982 * 150% + var(--top-position));
  left: calc(0.2767395962 * 100%);
  transform: scale(max(4.3049839851, 2)) rotate(52.2577470485deg);
}
.confetti__item:nth-child(72) {
  top: calc(0.3307669236 * 150% + var(--top-position));
  left: calc(0.0595572157 * 100%);
  transform: scale(max(0.7330033139, 2)) rotate(45.5096161839deg);
}
.confetti__item:nth-child(73) {
  top: calc(0.5445529585 * 150% + var(--top-position));
  left: calc(0.6044161489 * 100%);
  transform: scale(max(1.6376157152, 2)) rotate(82.5948944684deg);
}
.confetti__item:nth-child(74) {
  top: calc(0.5978640608 * 150% + var(--top-position));
  left: calc(0.9088521034 * 100%);
  transform: scale(max(2.8509502865, 2)) rotate(82.1316922776deg);
}
.confetti__item:nth-child(75) {
  top: calc(0.9083778112 * 150% + var(--top-position));
  left: calc(0.8148823373 * 100%);
  transform: scale(max(0.5958802406, 2)) rotate(77.3324963694deg);
}
.confetti__item:nth-child(76) {
  top: calc(0.0570846622 * 150% + var(--top-position));
  left: calc(0.639687615 * 100%);
  transform: scale(max(2.7557612217, 2)) rotate(23.0990063162deg);
}
.confetti__item:nth-child(77) {
  top: calc(0.2559477542 * 150% + var(--top-position));
  left: calc(0.3164893592 * 100%);
  transform: scale(max(0.1112115877, 2)) rotate(66.5035476842deg);
}
.confetti__item:nth-child(78) {
  top: calc(0.3778939782 * 150% + var(--top-position));
  left: calc(0.7942343079 * 100%);
  transform: scale(max(1.064831385, 2)) rotate(47.0630636452deg);
}
.confetti__item:nth-child(79) {
  top: calc(0.0094646557 * 150% + var(--top-position));
  left: calc(0.1430897496 * 100%);
  transform: scale(max(4.8519217192, 2)) rotate(5.3270047315deg);
}
.confetti__item:nth-child(80) {
  top: calc(0.4471133114 * 150% + var(--top-position));
  left: calc(0.8362386471 * 100%);
  transform: scale(max(0.681770453, 2)) rotate(27.5157815998deg);
}
.confetti__item:nth-child(81) {
  top: calc(0.1431424786 * 150% + var(--top-position));
  left: calc(0.689615212 * 100%);
  transform: scale(max(1.9126289845, 2)) rotate(1.3595991234deg);
}
.confetti__item:nth-child(82) {
  top: calc(0.7075547055 * 150% + var(--top-position));
  left: calc(0.2249337233 * 100%);
  transform: scale(max(3.6655224653, 2)) rotate(41.8046946606deg);
}
.confetti__item:nth-child(83) {
  top: calc(0.9727649101 * 150% + var(--top-position));
  left: calc(0.5263177027 * 100%);
  transform: scale(max(1.7889220365, 2)) rotate(44.0721340673deg);
}
.confetti__item:nth-child(84) {
  top: calc(0.0459496531 * 150% + var(--top-position));
  left: calc(0.3199643643 * 100%);
  transform: scale(max(1.4039201238, 2)) rotate(65.4186237463deg);
}
.confetti__item:nth-child(85) {
  top: calc(0.0358028877 * 150% + var(--top-position));
  left: calc(0.1018607166 * 100%);
  transform: scale(max(2.6011953272, 2)) rotate(1.2808042829deg);
}
.confetti__item:nth-child(86) {
  top: calc(0.5146594056 * 150% + var(--top-position));
  left: calc(0.7677026258 * 100%);
  transform: scale(max(1.4307111828, 2)) rotate(26.0522401631deg);
}
.confetti__item:nth-child(87) {
  top: calc(0.3035367804 * 150% + var(--top-position));
  left: calc(0.6835397192 * 100%);
  transform: scale(max(0.9691165826, 2)) rotate(45.081658485deg);
}
.confetti__item:nth-child(88) {
  top: calc(0.4909656301 * 150% + var(--top-position));
  left: calc(0.995752878 * 100%);
  transform: scale(max(1.6790669195, 2)) rotate(35.0039089333deg);
}
.confetti__item:nth-child(89) {
  top: calc(0.4960643903 * 150% + var(--top-position));
  left: calc(0.4149668793 * 100%);
  transform: scale(max(2.3310651714, 2)) rotate(53.7745948989deg);
}
.confetti__item:nth-child(90) {
  top: calc(0.5007346974 * 150% + var(--top-position));
  left: calc(0.4673563502 * 100%);
  transform: scale(max(0.1970851363, 2)) rotate(50.02886245deg);
}
.confetti__item:nth-child(91) {
  top: calc(0.3684477591 * 150% + var(--top-position));
  left: calc(0.2891773914 * 100%);
  transform: scale(max(2.1347030837, 2)) rotate(15.3535228404deg);
}
.confetti__item:nth-child(92) {
  top: calc(0.1903381679 * 150% + var(--top-position));
  left: calc(0.1275223684 * 100%);
  transform: scale(max(1.5590360011, 2)) rotate(54.5075507108deg);
}
.confetti__item:nth-child(93) {
  top: calc(0.208274942 * 150% + var(--top-position));
  left: calc(0.3044239266 * 100%);
  transform: scale(max(0.0538000336, 2)) rotate(47.9796099757deg);
}
.confetti__item:nth-child(94) {
  top: calc(0.0916050448 * 150% + var(--top-position));
  left: calc(0.3521573035 * 100%);
  transform: scale(max(0.7266702698, 2)) rotate(39.8129731397deg);
}
.confetti__item:nth-child(95) {
  top: calc(0.3219628349 * 150% + var(--top-position));
  left: calc(0.6042426259 * 100%);
  transform: scale(max(0.8571552558, 2)) rotate(87.8573257383deg);
}
.confetti__item:nth-child(96) {
  top: calc(0.5938268604 * 150% + var(--top-position));
  left: calc(0.8520860317 * 100%);
  transform: scale(max(3.7272411514, 2)) rotate(88.8014237369deg);
}
.confetti__item:nth-child(97) {
  top: calc(0.9332480765 * 150% + var(--top-position));
  left: calc(0.5855041607 * 100%);
  transform: scale(max(4.035080498, 2)) rotate(48.5538069736deg);
}
.confetti__item:nth-child(98) {
  top: calc(0.4958787949 * 150% + var(--top-position));
  left: calc(0.6755680362 * 100%);
  transform: scale(max(2.0984844711, 2)) rotate(81.2314202124deg);
}
.confetti__item:nth-child(99) {
  top: calc(0.5770436466 * 150% + var(--top-position));
  left: calc(0.114885501 * 100%);
  transform: scale(max(3.7188274803, 2)) rotate(87.3752691957deg);
}
.confetti__item:nth-child(100) {
  top: calc(0.2007317051 * 150% + var(--top-position));
  left: calc(0.7085144805 * 100%);
  transform: scale(max(2.6305592076, 2)) rotate(67.7582640155deg);
}
.confetti__item:nth-child(101) {
  top: calc(0.002927014 * 150% + var(--top-position));
  left: calc(0.0842935465 * 100%);
  transform: scale(max(4.8257123731, 2)) rotate(32.7306426001deg);
}
.confetti__item:nth-child(102) {
  top: calc(0.0320818552 * 150% + var(--top-position));
  left: calc(0.3773417801 * 100%);
  transform: scale(max(2.3291511087, 2)) rotate(31.0339770308deg);
}
.confetti__item:nth-child(103) {
  top: calc(0.7937176625 * 150% + var(--top-position));
  left: calc(0.8040093324 * 100%);
  transform: scale(max(1.8174346442, 2)) rotate(82.7643172135deg);
}
.confetti__item:nth-child(104) {
  top: calc(0.1417323778 * 150% + var(--top-position));
  left: calc(0.952296501 * 100%);
  transform: scale(max(1.6305407998, 2)) rotate(58.8346627688deg);
}
.confetti__item:nth-child(105) {
  top: calc(0.624300043 * 150% + var(--top-position));
  left: calc(0.7053568864 * 100%);
  transform: scale(max(4.4523833895, 2)) rotate(38.2974625747deg);
}
.confetti__item:nth-child(106) {
  top: calc(0.0347161111 * 150% + var(--top-position));
  left: calc(0.0599077898 * 100%);
  transform: scale(max(3.0030427092, 2)) rotate(68.1015265741deg);
}
.confetti__item:nth-child(107) {
  top: calc(0.3045026404 * 150% + var(--top-position));
  left: calc(0.8896609008 * 100%);
  transform: scale(max(3.4662575258, 2)) rotate(85.0452586907deg);
}
.confetti__item:nth-child(108) {
  top: calc(0.4343023309 * 150% + var(--top-position));
  left: calc(0.1199142389 * 100%);
  transform: scale(max(3.724882489, 2)) rotate(35.1177631465deg);
}
.confetti__item:nth-child(109) {
  top: calc(0.5217185589 * 150% + var(--top-position));
  left: calc(0.516386289 * 100%);
  transform: scale(max(4.7898864479, 2)) rotate(22.8837939397deg);
}
.confetti__item:nth-child(110) {
  top: calc(0.2676338467 * 150% + var(--top-position));
  left: calc(0.3808469865 * 100%);
  transform: scale(max(0.6404256942, 2)) rotate(38.9793976152deg);
}
.confetti__item:nth-child(111) {
  top: calc(0.992697916 * 150% + var(--top-position));
  left: calc(0.6016578492 * 100%);
  transform: scale(max(0.9206839162, 2)) rotate(8.0348000115deg);
}
.confetti__item:nth-child(112) {
  top: calc(0.3619968636 * 150% + var(--top-position));
  left: calc(0.1229857175 * 100%);
  transform: scale(max(1.0489618164, 2)) rotate(36.4931091158deg);
}
.confetti__item:nth-child(113) {
  top: calc(0.6753260046 * 150% + var(--top-position));
  left: calc(0.137396438 * 100%);
  transform: scale(max(1.8026088633, 2)) rotate(46.8393728753deg);
}
.confetti__item:nth-child(114) {
  top: calc(0.1846204541 * 150% + var(--top-position));
  left: calc(0.7669872364 * 100%);
  transform: scale(max(1.702464065, 2)) rotate(79.4784712626deg);
}
.confetti__item:nth-child(115) {
  top: calc(0.1499237346 * 150% + var(--top-position));
  left: calc(0.2261083146 * 100%);
  transform: scale(max(3.3815543042, 2)) rotate(0.6346598152deg);
}
.confetti__item:nth-child(116) {
  top: calc(0.0707439457 * 150% + var(--top-position));
  left: calc(0.1632604596 * 100%);
  transform: scale(max(3.0610732162, 2)) rotate(7.1484692874deg);
}
.confetti__item:nth-child(117) {
  top: calc(0.5050338415 * 150% + var(--top-position));
  left: calc(0.1177451713 * 100%);
  transform: scale(max(4.9824478488, 2)) rotate(58.3356886145deg);
}
.confetti__item:nth-child(118) {
  top: calc(0.9363895111 * 150% + var(--top-position));
  left: calc(0.9090616609 * 100%);
  transform: scale(max(4.0030120592, 2)) rotate(70.4739466963deg);
}
.confetti__item:nth-child(119) {
  top: calc(0.0026046181 * 150% + var(--top-position));
  left: calc(0.6486727315 * 100%);
  transform: scale(max(2.7955872787, 2)) rotate(19.3737257268deg);
}
.confetti__item:nth-child(120) {
  top: calc(0.5736946456 * 150% + var(--top-position));
  left: calc(0.025927972 * 100%);
  transform: scale(max(0.1117596444, 2)) rotate(43.7041765156deg);
}
.confetti--active {
  --top-position: 200vh;
}
.confetti--active .confetti__item {
  transition: top 10s ease;
}
.confetti--active .confetti__item:nth-child(3n) {
  transition: top 8s ease;
}
.confetti--active .confetti__item:nth-child(4n) {
  transition: top 12s ease;
}
</style>


  
  
</head>

<body translate="no">
  <div class="scratch-win">
  <div class="scratch-win__title"> Scratch & win</div>
  <div class="scratch-win__scratcher">
    <div class="scratch-win__background">You win</div>
    <canvas id="canvas" class="scratch-win__foreground"></canvas>
  </div>
</div>

<div id="coin" class="scratch-win__coin">
  <div class="scratch-win__coin-side"></div>
  <div class="scratch-win__coin-base"></div>
</div>

<div id="confetti" class="confetti">
  <svg class="confetti__item confetti__item--circle" width="6" height="6" viewBox="0 0 6 6" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M0.979033 1.30301C1.85813 0.337112 3.35383 0.26675 4.31973 1.14585C5.28563 2.02495 5.35599 3.52065 4.47684 4.48647C3.59775 5.45237 2.10205 5.52273 1.13623 4.64358C0.170248 3.76453 0.0999339 2.26891 0.979033 1.30301Z" fill="#a864fd" />
  </svg>
  <svg class="confetti__item confetti__item--circle" width="6" height="6" viewBox="0 0 6 6" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M0.979033 1.30301C1.85813 0.337112 3.35383 0.26675 4.31973 1.14585C5.28563 2.02495 5.35599 3.52065 4.47684 4.48647C3.59775 5.45237 2.10205 5.52273 1.13623 4.64358C0.170248 3.76453 0.0999339 2.26891 0.979033 1.30301Z" fill="#a864fd" />
  </svg> <svg class="confetti__item confetti__item--circle" width="6" height="6" viewBox="0 0 6 6" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M0.979033 1.30301C1.85813 0.337112 3.35383 0.26675 4.31973 1.14585C5.28563 2.02495 5.35599 3.52065 4.47684 4.48647C3.59775 5.45237 2.10205 5.52273 1.13623 4.64358C0.170248 3.76453 0.0999339 2.26891 0.979033 1.30301Z" fill="#a864fd" />
  </svg> <svg class="confetti__item confetti__item--circle" width="6" height="6" viewBox="0 0 6 6" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M0.979033 1.30301C1.85813 0.337112 3.35383 0.26675 4.31973 1.14585C5.28563 2.02495 5.35599 3.52065 4.47684 4.48647C3.59775 5.45237 2.10205 5.52273 1.13623 4.64358C0.170248 3.76453 0.0999339 2.26891 0.979033 1.30301Z" fill="#a864fd" />
  </svg> <svg cl.........完整代码请登录后点击上方下载按钮下载查看

网友评论0