scss+pug实现三维可交互莫比乌斯环效果代码

代码语言:html

所属分类:三维

代码描述:scss+pug实现三维可交互莫比乌斯环效果代码,采用pug生成dom,采用scss生成css代码。

代码标签: scss pug 三维 交互 莫比乌斯

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

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />
    <title>BFW NEW PAGE</title>
    
      
<style type = 'text/scss'>
* {
	transform-style: preserve-3d;
	box-sizing: border-box;
}

body {
	margin: 0;
	padding: 0;
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	perspective: 100vmin;
	background: radial-gradient(circle at 50% 100%, #607D8B80, #fff0), radial-gradient(circle at 50% 0%, #607D8B40, #1e0053);
	background-color: #000;
}

.content {
	width: 50vmin;
	height: 50vmin;
	left: calc(50% - 25vmin);
	top: calc(50% - 25vmin);
	background: #f000;
	display: flex;
	align-items: center;
	justify-content: center;
	transform: rotateX(40deg);
	position: absolute;
	transition: all 0.5s ease 0s;
}

.cuboid {
	--height: 6;
	--width: 6;
	--depth: 6;
	--hue: 250;
	--sat: 15%;
	--lum: 45%;
	height: calc(var(--height) * 1vmin);
	width: calc(var(--width) * 1vmin);
	position: absolute;
}

.cuboid .side {
	position: absolute;
	top: 50%;
	left: 50%;
	height: 100%;
	width: 100%;
	border-radius: 2px;
	background: hsl(var(--hue), var(--sat), var(--lum));
}

.cuboid .side:nth-of-type(1) {
	transform: translate3d(-50%, -50%, calc(var(--depth) * 0.5vmin));
}
.cuboid .side:nth-of-type(2) {
	transform: translate3d(-50%, -50%, calc(var(--depth) * -0.5vmin)) rotateY(180deg);
}
.cuboid .side:nth-of-type(3) {
	width: calc(var(--depth) * 1vmin);
	transform: translate(-50%, -50%) rotateY(90deg)	translate3d(0, 0, calc(var(--width) * 0.5vmin));
	--lum: 70%;
}
.cuboid .side:nth-of-type(4) {
	width: calc(var(--depth) * 1vmin);
	transform: translate(-50%, -50%) rotateY(-90deg) translate3d(0, 0, calc(var(--width) * 0.5vmin));
	--lum: 70%;
}
.cuboid .side:nth-of-type(5) {
	height: calc(var(--depth) * 1vmin);
	transform: translate(-50%, -50%) rotateX(90deg) translate3d(0, 0, calc(var(--height) * 0.5vmin));
	--lum: 20%;
}
.cuboid .side:nth-of-type(6) {
	height: calc(var(--depth) * 1vmin);
	transform: translate(-50%, -50%) rotateX(-90deg) translate3d(0, 0, calc(var(--height) * 0.5vmin));
	--lum: 20%;
}


.cuboid .side:before {
	content: "";
	position: absolute;
	width: 100%;
	height: 100%;
	background:	
		repeating-conic-gradient(#0004 0%, #fff0 .0003%, #fff0 .0005%,  #fff0 .00095%),
		repeating-conic-gradient(#fff2 0%, #fff0 .0005%, #fff0 .0015%, #fff0 .009%);
	background-size: 100% 101%;
}

.line {
	width: 50%;
	height: 10vmin;
	position: absolute;
	left: 0;
	transform-origin: 100% 50%;
}

@for $i .........完整代码请登录后点击上方下载按钮下载查看

网友评论0