three实现五条带子反向鼠标滚轮驱动图片胶片滚动代码

代码语言:html

所属分类:加载滚动

代码描述:three实现五条带子反向鼠标滚轮驱动图片胶片滚动代码

代码标签: three 五条 带子 反向 鼠标 滚轮 驱动 图片 胶片 滚动 代码

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

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

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

  
  
<style>
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html,
body {
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #000;
	font-family: Arial, sans-serif;
}

canvas {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	outline: none;
}

.info {
	position: fixed;
	bottom: 20px;
	left: 20px;
	background: rgba(255, 255, 255, 0.9);
	padding: 10px;
	border-radius: 5px;
	z-index: 100;
	max-width: 300px;
	font-size: 14px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	pointer-events: none;
}

.loading {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: white;
	padding: 20px;
	border-radius: 10px;
	z-index: 1000;
	text-align: center;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

::-webkit-scrollbar {
	display: none;
}

canvas:focus {
	outline: 2px solid rgba(255, 255, 255, 0.3);
}
a {
	color: #9cf;
	text-decoration: none;
}

a:hover {
	color: white;
}
#ui {
	position: fixed;
	right: 12px;
	bottom: 12px;
	z-index: 10;
	background: rgba(0, 0, 0, 0.35);
	padding: 8px;
	border-radius: 8px;
	z-index: 1000;
	color: #fff;
}
.hint {
	opacity: 0.85;
	font-size: 13px;
}

.copy {
	position: fixed;
	top: 20px;
	right: 20px;
	color: #000;
	background: rgb(255 255 255 / 0.9);
	padding: 10px;
	border-radius: 5px;
	font-size: 12px;
}
</style>


  
  
</head>

<body translate="no">
  <div class="info">
	• Wheel = scrolling<br>
	• Double-click = reset<br>
	• Up/down arrows = navigation<br>
	• Click canvas to use keyboard
</div>

<div class="loading" id="loading">
	<div id="loadingText">Chargement des images...</div>
	<div id="progressBar" style="width: 200px; height: 4px; background: #ddd; margin-top: 10px; border-radius: 2px;">
		<div id="progressFill" style="width: 0%; height: 100%; background: #666; border-radius: 2px;"></div>
	</div>
</div>

  <script src='https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js'></script>
    <script  >
let scrollY = 0;
let targetScrollY = 0;
let scrollVelocity = 0;
let materials = [];
let totalImagesToLoad = 0;
let loadedImagesCount = 0;
let meshes = [];
const scene = new THREE.Scene();
const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0.1, 10);
const renderer = new THREE.WebGLRenderer({
  antialias: !0,
  alpha: !0 });

renderer.setSize(window.innerWidth, window.innerHeight);
renderer.domElement.setAttribute("tabindex", "0");
renderer.domElement.style.outline = "none";
document.body.appendChild(renderer.domElement);
camera.position.z = 1;
console.log("&Toc on codepen - https://codepen.io/ol-ivier");
const BAND_WIDTH = 120;
const IMAGE_WIDTH = 100;
const IMAGE_GAP = 20;
const CLONE_COUNT = .........完整代码请登录后点击上方下载按钮下载查看

网友评论0