gl-matrix+webgl实现可调参数的三维物体运行动画效果代码

代码语言:html

所属分类:三维

代码描述:gl-matrix+webgl实现可调参数的三维物体运行动画效果代码

代码标签: gl-matrix webgl 调参数 三维 物体 运行 动画

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

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

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

  
  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Space+Mono&display=swap");

body,
html {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #000;
	font-family: "Space Mono", monospace;
	font-size: 1rem;
}
canvas {
	width: 100%;
	height: 100%;
}
#ui {
	position: absolute;
	top: 10px;
	left: 10px;
	color: white;
	background: rgba(0, 0, 0, 0.7);
	padding: 10px;
	border-radius: 5px;
	max-width: 460px;
}
.control {
	margin-bottom: 10px;
}
label {
	display: inline-block;
	width: 120px;
}
input[type="range"] {
	width: 260px;
}
input[type="color"] {
	vertical-align: middle;
}
#togglePanel {
	cursor: pointer;
	user-select: none;
	font-size: 20px;
	margin-bottom: 0;
}
.colorBtn {
	margin-left: 5px;
	cursor: pointer;
	font-family: "Space Mono", monospace;
	font-size: 1rem;
}
button,
input {
	font-family: "Space Mono", monospace;
	font-size: 1rem;
}
.sliderValue {
	display: inline-block;
	width: 40px;
	text-align: right;
	margin-left: 5px;
}
#fullscreenBtn {
	margin-top: 10px;
	width: 100%;
	padding: 5px 10px;
	background: rgba(255, 255, 255, 0.2);
	color: white;
	border: none;
	border-radius: 5px;
	cursor: pointer;
}
</style>


  
</head>

<body translate="no">
  <canvas id="glCanvas"></canvas>

<div id="ui">
	<div id="togglePanel">☰</div>
	<div id="controls">
		<div class="control">
			<label for="zoomLevel">Zoom:</label>
			<input type="range" id="zoomLevel" min="0.1" max="3" step="0.1" value="1">
			<span id="zoomValue" class="sliderValue">1.00</span>
		</div>
		<div class="control">
			<label for="rotationSpeed">Rotation:</label>
			<input type="range" id="rotationSpeed" min="0" max="3" step="0.01" value="0.3">
			<span id="rotationValue" class="sliderValue">0.30</span>
		</div>
		<div class="control">
			<label for="waveSpeed">Wave:</label>
			<input type="range" id="waveSpeed" min="0" max="2" step="0.01" value="0.1">
			<span id="waveValue" class="sliderValue">0.10</span>
		</div>
		<div class="control">
			<label for="cubeColor">Cube Color:</label>
			<input type="color" id="cubeColor" value="#b8934a">
			<button class="colorBtn" id="cubeRandom">Random</button>
			<button class="colorBtn" id="cubeRainbow">Rainbow</button>
		</div>
		<div class=&q.........完整代码请登录后点击上方下载按钮下载查看

网友评论0