div+css实现骷髅脸棒棒糖趣闻开关效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现骷髅脸棒棒糖趣闻开关效果代码

代码标签: div css 骷髅 棒棒糖 趣闻 开关

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

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

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

  
  
  
<style>
@import url('https://fonts.googleapis.com/css2?family=Nanum+Pen+Script&display=swap');

:root {
	--sz: 10vmin;
	--on: #99dc39;
	--of: #F44336;
	--lg: var(--of);
	--ttf: ease-in-out;
}	

*, *:before, *:after {
	box-sizing: border-box;
	/*#btn:checked + label .thumb*/
}

body {
	margin: 0;
	padding: 0;
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: radial-gradient(circle at 50% 0%, #55555d, #141414);
}

.content {
	position: relative;
    width: calc(var(--sz) * 5);
    height: calc(var(--sz) * 3);
    display: flex;
    align-items: center;
    justify-content: center;
}

input {
	display: none;
}

label[for=btn] {
    position: absolute;
    width: calc(var(--sz) * 4);
    height: calc(var(--sz) * 2);
    background: linear-gradient(0deg, #12172080, #0d121780);
    border-radius: var(--sz);
	overflow: hidden;
    box-shadow: 
		0 0 calc(var(--sz) / 50) calc(var(--sz) / 50) #000000e0, 
		0 0 calc(var(--sz) / 10) calc(var(--sz) / 100) #0b0b10 inset;
}


.thumb {
	position: absolute;
    width: calc(calc(var(--sz) * 2) - calc(var(--sz) / 4));
    height: calc(calc(var(--sz) * 2) - calc(var(--sz) / 4));
    top: calc(calc( var(--sz) / 10) + calc(var(--sz) / 50));
    left: calc(calc( var(--sz) / 10) + calc(var(--sz) / 50));
    background: linear-gradient(0deg, #a1a1a1, #ffffff), linear-gradient(0deg, #212121, #474747);
    border-radius: var(--sz);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
    transition-delay: 0.5s;
    transition-duration: 0.5s;
    transition-timing-function: var(--ttf);
    box-shadow: calc(var(--sz) / -50) calc(var(--sz) / 50) calc(var(--sz) / 30) 0 #fff2 inset, 0 0 calc(var(--sz) / 10) calc(var(--sz) / 50) #000c;
    animation: start 1s var(--ttf) 0s 1;
    background-repeat: no-repeat;
    background-size: 200% 100%, 100% 100%;
    background-position: 200% 0, 0 0;
    background: #fff0;
}

#btn:checked + label .thumb {
	left: calc(calc(100% - calc(calc(var(--sz) * 2) - calc(var(--sz) / 3))) - calc(calc( var(--sz) / 10) + calc(var(--sz) / 10)));
    background-position: 100% 0, 0 0;
    box-shadow: calc(var(--sz) / -50) calc(var(--sz) / 50) calc(var(--sz) / 30) 0 #fff inset, 0 0 calc(var(--sz) / 10) calc(var(--sz) / 50) #000c;
}


@keyframes start {
	100% {
		left: calc(calc(100% - calc(calc(var(--sz) * 2) - calc(var(--sz) / 3))) - calc(calc( var(--sz) / 10) + calc(var(--sz) / 10)));
	}
	0%, 50% {		
		left: calc(calc( var(--sz) / 10) + calc(var(--sz) / 50));
	}
}












.arms {
    position: absolute;
    width: 200%;
    height: 100%;
    border-radius: 10vmin;
    overflow: hidden;
    right: -50%;
}













/* HUMAN */

.arm-human {
	position: absolute;
    width: 14vmin;
    height: 6vmin;
    background: radial-gradient(circle at 20% 80%, #333 0.45vmin, #fff0 calc(0.45vmin + 1px) 100%), radial-gradient(circle at 10% 80%, #333 0.45vmin, #fff0 calc(0.45vmin + 1px) 100%), #575757;
    right: -8%;
    top: calc(50% - 3vmin);
    border-radius: 0.25vmin;
    box-shadow: -3vmin -0.5vmin 0.1vmin -0.65vmin #fff;
	
	/*animation: catch2 1.5s var(--ttf) 0s reverse;*/
}

.hand-human {
	position: absolute;
    background: pink;
    width: 7vmin;
    height: 5vmin;
    left: -9.25vmin;
    border-radius: 21% 10% 80% 37% / 20% 12% 28% 32%;
    z-index: 0;
}


.finger {
	background: pink;
	position: absolute;
	width: 50%;
	height: 25%;
	border-radius: 3vmin 0 0 3vmin;
	left: -2vmin;
	border-left: 2px solid #0006;
	border-bottom: 1px solid #0004;
}

.finger:nth-child(2) {
    top: 25%;
    width: 60%;
    left: -40%;
}
.finger:nth-child(3) {
    top: 50%;
    left: -35%;
    width: 55%;
}
.finger:nth-child(4) {
    top: 75%;
    left: -20%;
    width: 40%;
}

.big-human {
    background: pink;
    border: 1px solid #0004;
    width: 34%;
    height: 26%;
    position: absolute;
    left: -9vmin;
    top: 0.65vmin;
    border-radius: 3vmin 1vmin 1vmin 3vmin;
    border-right-color: #fff0;
	z-index: 1;
}










@keyframes catch {
	 0% { right: -8%;}
	 25%, 33% { right: 25%; }
	 66%, 80% { right: 0%;  }
	 100% { right: -5%;  }
}


@keyframes catch2 {
	 0% { right: -8%;}
	 15%, 35% { right: 25%; }
	 65%, 87.5% { right: 0%;  }
	 100% { right: -5%;  }
}

#btn:not(:checked) + label .arms .arm-human {
	animation: catch 1.5s var(--ttf) 0s reverse;
}















/* BONES */



@keyframes check-on {
	 0% { left: -8%;}
	 25%, 33% { left: -2%; }
	 66%, 80% { left: 23%;  }
	 100% { left: -8%;  }
}

@keyframes check-off {
	 0% { left: -8%;}
	 25%, 33% { left: 0%; }
	 66%, 80% { left: 25%;  }
	 100% { left: -8%;  }
}

#btn:checked + label .arms .arm-bones {
	animation: check-on 1.5s var(--ttf) 0s;
}

.arm-bones {
	position: absolute;
    width: 16vmin;
    height: 5vmin;
    left: -8%;
    top: calc(50% - 2.5vmin);
    border-radius: 0.25vmin;
    /* transform: rotateY(180deg); */
    --bone: #ececec;
    /* animation: check-off 1.5s var(--ttf) 0s reverse; */
    --sdw-flt: drop-shadow(-2.5vmin 0vmin 0px var(--bone)) drop-shadow(0 0 1px #000);
    background: linear-gradient(180deg, #25272d, #24262c, #24262c);
    box-shadow: 10vmin 0 0 0 #24272d;
    background-repeat: no-repeat;
    background-size: 80% 100%;
    background-position: 125% 50%;
}

.bone {
    background: var(--bone);
    width: 8vmin;
    height: 2vmin;
    position: absolute;
    transform: rotate(0deg);
    top: 1.5vmin;
    left: -4vmin;
    /*filter: var(--sdw-flt);*/
}

.bone:before, .bone:after,
.big-bones:before, .big-bones:after  {
    content: "";
    background: var(--bone);
    width: 1.5vmin;
    height: 1.5vmin;
    position: absolute;
    left: -0.5vmin;
    top: -0.5vmin;
    border-radius: 100%;
    box-shadow: 8vmin 0 0 0 var(--bone);
}

.bone:after {
    top: calc(100% - 1vmin);
}


.arm-bones > .bone + .bone {
    top: 1.5vmin;
    left: 5.5vmin;
    height: 0.85vmin;
    width: 10.5vmin;
    box-shadow: 0 1.15vmin 0 0 var(--bone);
}
.arm-bones > .bone + .bone:before, 
.arm-bones > .bone + .bone:after {
    box-shadow: 10.15vmin 0 0 0 var(--bone);
}

.arm-bones > .bone + .bone:after {
    top: 100%;
}





/*** Hand ***/

.hand-bones {
	position: absolute;
    --balls: var(--bone) 0.5vmin, #fff0 calc(0.5vmin + 1px) 100%;
    background: 
		radial-gradient(circle at 91% 29%, var(--balls)), 
		radial-gradient(circle at 92% 49%, var(--balls)), 
		radial-gradient(circle at 91% 69%, var(--balls)), 
		radial-gradient(circle at 76% 21%, var(--balls)), 
		radial-gradient(circle at 78% 39%, var(--balls)), 
		radial-gradient(circle at 79% 58%, var(--balls)), 
		radial-gradient(circle at 78% 78%, var(--balls));
        width: 7vmin;
    height: 5vmin;
    left: 16.75vmin;
    z-index: 0;
    transform: rotateY(180deg);
    /*filter: var(--sdw-flt);*/
}

.hand-bones .bone, .big-bones {
    width: 3vmin;
    left: 1.35vmin;
    height: 0.75vmin;
	border-radius: 0.5vmin 0 0 0.5vmin;
}

.hand-bones .bone:before, .hand-bones .bone:after,
.big-bones:before, .big-bones:after {
    width: 0.8vmin;
    height: 0.8vmin;
    top: -0.25vmin;
    left: 2.25vmin;
	box-shadow: none;
}
.hand-bones .bone:after,
.big-bones:after {
    top: 0.125vmin;
}

.hand-bones .bone:nth-child(1) {
    transform: rotate(5deg) tran.........完整代码请登录后点击上方下载按钮下载查看

网友评论0