使用html+css+js+three.js写圣诞树

news2025/1/20 22:36:07

实现效果:

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

	<title>Musical Christmas Lights</title>

	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

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

		body {
			margin: 0;
			height: 100vh;
			overflow: hidden;
			display: flex;
			align-items: center;
			justify-content: center;
			background: #161616;
			color: #c5a880;
			font-family: sans-serif;
		}

		label {
			display: inline-block;
			background-color: #161616;
			padding: 16px;
			border-radius: 0.3rem;
			cursor: pointer;
			margin-top: 1rem;
			width: 300px;
			border-radius: 10px;
			border: 1px solid #c5a880;
			text-align: center;
		}

		ul {
			list-style-type: none;
			padding: 0;
			margin: 0;
		}

		.btn {
			background-color: #161616;
			border-radius: 10px;
			color: #c5a880;
			border: 1px solid #c5a880;
			padding: 16px;
			width: 300px;
			margin-bottom: 16px;
			line-height: 1.5;
			cursor: pointer;
		}

		.separator {
			font-weight: bold;
			text-align: center;
			width: 300px;
			margin: 16px 0px;
			color: #a07676;
		}

		.title {
			color: #a07676;
			font-weight: bold;
			font-size: 1.25rem;
			margin-bottom: 16px;
		}

		.text-loading {
			font-size: 2rem;
		}
	</style>

	<script>
		window.console = window.console || function(t) {};
	</script>



	<script>
		if (document.location.search.match(/type=embed/gi)) {
			window.parent.postMessage("resize", "*");
		}
	</script>


</head>

<body translate="no">
	<script src="https://cdn.jsdelivr.net/npm/three@0.115.0/build/three.min.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/three@0.115.0/examples/js/postprocessing/EffectComposer.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/three@0.115.0/examples/js/postprocessing/RenderPass.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/three@0.115.0/examples/js/postprocessing/ShaderPass.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/three@0.115.0/examples/js/shaders/CopyShader.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/three@0.115.0/examples/js/shaders/LuminosityHighPassShader.js">
	</script>
	<script src="https://cdn.jsdelivr.net/npm/three@0.115.0/examples/js/postprocessing/UnrealBloomPass.js"></script>

	<div id="overlay">
		<ul>
			<!-- <li class="title">请选择音乐</li> -->
			<li>
				<button class="btn" id="btnA" type="button">
					点击
				</button>
			</li>
			 <li><button class="btn" id="btnB" type="button">This Christmas by Dott</button></li> 
			<li><button class="btn" id="btnC" type="button">No room at the inn by TRG Banks</button></li> 
			<li><button class="btn" id="btnD" type="button">Jingle Bell Swing by Mark Smeby</button></li>
			<li class="separator">或者</li>
			<li>
				<input type="file" id="upload" hidden />
				<label for="upload">上传音乐</label>
			</li>
		</ul>
	</div>

	<script id="rendered-js">
		const {
			PI,
			sin,
			cos
		} = Math;
		const TAU = 2 * PI;

		const map = (value, sMin, sMax, dMin, dMax) => {
			return dMin + (value - sMin) / (sMax - sMin) * (dMax - dMin);
		};

		const range = (n, m = 0) =>
			Array(n).
		fill(m).
		map((i, j) => i + j);

		const rand = (max, min = 0) => min + Math.random() * (max - min);
		const randInt = (max, min = 0) => Math.floor(min + Math.random() * (max - min));
		const randChoise = arr => arr[randInt(arr.length)];
		const polar = (ang, r = 1) => [r * cos(ang), r * sin(ang)];

		let scene, camera, renderer, analyser;
		let step = 0;
		const uniforms = {
			time: {
				type: "f",
				value: 0.0
			},
			step: {
				type: "f",
				value: 0.0
			}
		};

		const params = {
			exposure: 1,
			bloomStrength: 0.9,
			bloomThreshold: 0,
			bloomRadius: 0.5
		};

		let composer;

		const fftSize = 2048;
		const totalPoints = 4000;

		const listener = new THREE.AudioListener();

		const audio = new THREE.Audio(listener);

		document.querySelector("input").addEventListener("change", uploadAudio, false);

		const buttons = document.querySelectorAll(".btn");
		buttons.forEach((button, index) =>
			button.addEventListener("click", () => loadAudio(index)));


		function init() {
			const overlay = document.getElementById("overlay");
			overlay.remove();

			scene = new THREE.Scene();
			renderer = new THREE.WebGLRenderer({
				antialias: true
			});
			renderer.setPixelRatio(window.devicePixelRatio);
			renderer.setSize(window.innerWidth, window.innerHeight);
			document.body.appendChild(renderer.domElement);

			camera = new THREE.PerspectiveCamera(
				60,
				window.innerWidth / window.innerHeight,
				1,
				1000);

			camera.position.set(-0.09397456774197047, -2.5597086635726947, 24.420789670889008);
			camera.rotation.set(0.10443543723052419, -0.003827152981119352, 0.0004011488708739715);

			const format = renderer.capabilities.isWebGL2 ?
				THREE.RedFormat :
				THREE.LuminanceFormat;

			uniforms.tAudioData = {
				value: new THREE.DataTexture(analyser.data, fftSize / 2, 1, format)
			};


			addPlane(scene, uniforms, 3000);
			addSnow(scene, uniforms);

			range(10).map(i => {
				addTree(scene, uniforms, totalPoints, [20, 0, -20 * i]);
				addTree(scene, uniforms, totalPoints, [-20, 0, -20 * i]);
			});

			const renderScene = new THREE.RenderPass(scene, camera);

			const bloomPass = new THREE.UnrealBloomPass(
				new THREE.Vector2(window.innerWidth, window.innerHeight),
				1.5,
				0.4,
				0.85);

			bloomPass.threshold = params.bloomThreshold;
			bloomPass.strength = params.bloomStrength;
			bloomPass.radius = params.bloomRadius;

			composer = new THREE.EffectComposer(renderer);
			composer.addPass(renderScene);
			composer.addPass(bloomPass);

			addListners(camera, renderer, composer);
			animate();
		}

		function animate(time) {
			analyser.getFrequencyData();
			uniforms.tAudioData.value.needsUpdate = true;
			step = (step + 1) % 1000;
			uniforms.time.value = time;
			uniforms.step.value = step;
			composer.render();
			requestAnimationFrame(animate);
		}

		function loadAudio(i) {
			document.getElementById("overlay").innerHTML =
				'<div class="text-loading">等一下哈 马上来啦...</div>';
			const files = [
				"https://files.freemusicarchive.org/storage-freemusicarchive-org/music/no_curator/Simon_Panrucker/Happy_Christmas_You_Guys/Simon_Panrucker_-_01_-_Snowflakes_Falling_Down.mp3",
				"https://files.freemusicarchive.org/storage-freemusicarchive-org/music/no_curator/Dott/This_Christmas/Dott_-_01_-_This_Christmas.mp3",
				"https://files.freemusicarchive.org/storage-freemusicarchive-org/music/ccCommunity/TRG_Banks/TRG_Banks_Christmas_Album/TRG_Banks_-_12_-_No_room_at_the_inn.mp3",
				"https://files.freemusicarchive.org/storage-freemusicarchive-org/music/ccCommunity/Mark_Smeby/En_attendant_Nol/Mark_Smeby_-_07_-_Jingle_Bell_Swing.mp3"
			];

			const file = files[i];

			const loader = new THREE.AudioLoader();
			loader.load(file, function(buffer) {
				audio.setBuffer(buffer);
				audio.play();
				analyser = new THREE.AudioAnalyser(audio, fftSize);
				init();
			});




		}


		function uploadAudio(event) {
			document.getElementById("overlay").innerHTML =
				'<div class="text-loading">等一下哈 马上来啦...</div>';
			const files = event.target.files;
			const reader = new FileReader();

			reader.onload = function(file) {
				var arrayBuffer = file.target.result;

				listener.context.decodeAudioData(arrayBuffer, function(audioBuffer) {
					audio.setBuffer(audioBuffer);
					audio.play();
					analyser = new THREE.AudioAnalyser(audio, fftSize);
					init();
				});
			};

			reader.readAsArrayBuffer(files[0]);
		}

		function addTree(scene, uniforms, totalPoints, treePosition) {
			const vertexShader = `
  attribute float mIndex;
  varying vec3 vColor;
  varying float opacity;
  uniform sampler2D tAudioData;
  float norm(float value, float min, float max ){
   return (value - min) / (max - min);
  }
  float lerp(float norm, float min, float max){
   return (max - min) * norm + min;
  }
  float map(float value, float sourceMin, float sourceMax, float destMin, float destMax){
   return lerp(norm(value, sourceMin, sourceMax), destMin, destMax);
  }
  void main() {
   vColor = color;
   vec3 p = position;
   vec4 mvPosition = modelViewMatrix * vec4( p, 1.0 );
   float amplitude = texture2D( tAudioData, vec2( mIndex, 0.1 ) ).r;
   float amplitudeClamped = clamp(amplitude-0.4,0.0, 0.6 );
   float sizeMapped = map(amplitudeClamped, 0.0, 0.6, 1.0, 20.0);
   opacity = map(mvPosition.z , -200.0, 15.0, 0.0, 1.0);
   gl_PointSize = sizeMapped * ( 100.0 / -mvPosition.z );
   gl_Position = projectionMatrix * mvPosition;
  }
  `;
			const fragmentShader = `
  varying vec3 vColor;
  varying float opacity;
  uniform sampler2D pointTexture;
  void main() {
   gl_FragColor = vec4( vColor, opacity );
   gl_FragColor = gl_FragColor * texture2D( pointTexture, gl_PointCoord ); 
  }
  `;
			const shaderMaterial = new THREE.ShaderMaterial({
				uniforms: {
					...uniforms,
					pointTexture: {
						value: new THREE.TextureLoader().load(`https://assets.codepen.io/3685267/spark1.png`)
					}
				},


				vertexShader,
				fragmentShader,
				blending: THREE.AdditiveBlending,
				depthTest: false,
				transparent: true,
				vertexColors: true
			});


			const geometry = new THREE.BufferGeometry();
			const positions = [];
			const colors = [];
			const sizes = [];
			const phases = [];
			const mIndexs = [];

			const color = new THREE.Color();

			for (let i = 0; i < totalPoints; i++) {
				const t = Math.random();
				const y = map(t, 0, 1, -8, 10);
				const ang = map(t, 0, 1, 0, 6 * TAU) + TAU / 2 * (i % 2);
				const [z, x] = polar(ang, map(t, 0, 1, 5, 0));

				const modifier = map(t, 0, 1, 1, 0);
				positions.push(x + rand(-0.3 * modifier, 0.3 * modifier));
				positions.push(y + rand(-0.3 * modifier, 0.3 * modifier));
				positions.push(z + rand(-0.3 * modifier, 0.3 * modifier));

				color.setHSL(map(i, 0, totalPoints, 1.0, 0.0), 1.0, 0.5);

				colors.push(color.r, color.g, color.b);
				phases.push(rand(1000));
				sizes.push(1);
				const mIndex = map(i, 0, totalPoints, 1.0, 0.0);
				mIndexs.push(mIndex);
			}

			geometry.setAttribute(
				"position",
				new THREE.Float32BufferAttribute(positions, 3).setUsage(
					THREE.DynamicDrawUsage));


			geometry.setAttribute("color", new THREE.Float32BufferAttribute(colors, 3));
			geometry.setAttribute("size", new THREE.Float32BufferAttribute(sizes, 1));
			geometry.setAttribute("phase", new THREE.Float32BufferAttribute(phases, 1));
			geometry.setAttribute("mIndex", new THREE.Float32BufferAttribute(mIndexs, 1));

			const tree = new THREE.Points(geometry, shaderMaterial);

			const [px, py, pz] = treePosition;

			tree.position.x = px;
			tree.position.y = py;
			tree.position.z = pz;

			scene.add(tree);
		}

		function addSnow(scene, uniforms) {
			const vertexShader = `
  attribute float size;
  attribute float phase;
  attribute float phaseSecondary;
  varying vec3 vColor;
  varying float opacity;
  uniform float time;
  uniform float step;
  float norm(float value, float min, float max ){
   return (value - min) / (max - min);
  }
  float lerp(float norm, float min, float max){
   return (max - min) * norm + min;
  }
  float map(float value, float sourceMin, float sourceMax, float destMin, float destMax){
   return lerp(norm(value, sourceMin, sourceMax), destMin, destMax);
  }
  void main() {
   float t = time* 0.0006;
   vColor = color;
   vec3 p = position;
   p.y = map(mod(phase+step, 1000.0), 0.0, 1000.0, 25.0, -8.0);
   p.x += sin(t+phase);
   p.z += sin(t+phaseSecondary);
   opacity = map(p.z, -150.0, 15.0, 0.0, 1.0);
   vec4 mvPosition = modelViewMatrix * vec4( p, 1.0 );
   gl_PointSize = size * ( 100.0 / -mvPosition.z );
   gl_Position = projectionMatrix * mvPosition;
  }
  `;

			const fragmentShader = `
  uniform sampler2D pointTexture;
  varying vec3 vColor;
  varying float opacity;
  void main() {
   gl_FragColor = vec4( vColor, opacity );
   gl_FragColor = gl_FragColor * texture2D( pointTexture, gl_PointCoord ); 
  }
  `;

			function createSnowSet(sprite) {
				const totalPoints = 300;
				const shaderMaterial = new THREE.ShaderMaterial({
					uniforms: {
						...uniforms,
						pointTexture: {
							value: new THREE.TextureLoader().load(sprite)
						}
					},


					vertexShader,
					fragmentShader,
					blending: THREE.AdditiveBlending,
					depthTest: false,
					transparent: true,
					vertexColors: true
				});


				const geometry = new THREE.BufferGeometry();
				const positions = [];
				const colors = [];
				const sizes = [];
				const phases = [];
				const phaseSecondaries = [];

				const color = new THREE.Color();

				for (let i = 0; i < totalPoints; i++) {
					const [x, y, z] = [rand(25, -25), 0, rand(15, -150)];
					positions.push(x);
					positions.push(y);
					positions.push(z);

					color.set(randChoise(["#f1d4d4", "#f1f6f9", "#eeeeee", "#f1f1e8"]));

					colors.push(color.r, color.g, color.b);
					phases.push(rand(1000));
					phaseSecondaries.push(rand(1000));
					sizes.push(rand(4, 2));
				}

				geometry.setAttribute(
					"position",
					new THREE.Float32BufferAttribute(positions, 3));

				geometry.setAttribute("color", new THREE.Float32BufferAttribute(colors, 3));
				geometry.setAttribute("size", new THREE.Float32BufferAttribute(sizes, 1));
				geometry.setAttribute("phase", new THREE.Float32BufferAttribute(phases, 1));
				geometry.setAttribute(
					"phaseSecondary",
					new THREE.Float32BufferAttribute(phaseSecondaries, 1));


				const mesh = new THREE.Points(geometry, shaderMaterial);

				scene.add(mesh);
			}
			const sprites = [
				"https://assets.codepen.io/3685267/snowflake1.png",
				"https://assets.codepen.io/3685267/snowflake2.png",
				"https://assets.codepen.io/3685267/snowflake3.png",
				"https://assets.codepen.io/3685267/snowflake4.png",
				"https://assets.codepen.io/3685267/snowflake5.png"
			];

			sprites.forEach(sprite => {
				createSnowSet(sprite);
			});
		}

		function addPlane(scene, uniforms, totalPoints) {
			const vertexShader = `
  attribute float size;
  attribute vec3 customColor;
  varying vec3 vColor;
  void main() {
   vColor = customColor;
   vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
   gl_PointSize = size * ( 300.0 / -mvPosition.z );
   gl_Position = projectionMatrix * mvPosition;
  }
  `;
			const fragmentShader = `
  uniform vec3 color;
  uniform sampler2D pointTexture;
  varying vec3 vColor;
  void main() {
   gl_FragColor = vec4( vColor, 1.0 );
   gl_FragColor = gl_FragColor * texture2D( pointTexture, gl_PointCoord );
  }
  `;
			const shaderMaterial = new THREE.ShaderMaterial({
				uniforms: {
					...uniforms,
					pointTexture: {
						value: new THREE.TextureLoader().load(`https://assets.codepen.io/3685267/spark1.png`)
					}
				},


				vertexShader,
				fragmentShader,
				blending: THREE.AdditiveBlending,
				depthTest: false,
				transparent: true,
				vertexColors: true
			});


			const geometry = new THREE.BufferGeometry();
			const positions = [];
			const colors = [];
			const sizes = [];

			const color = new THREE.Color();

			for (let i = 0; i < totalPoints; i++) {
				const [x, y, z] = [rand(-25, 25), 0, rand(-150, 15)];
				positions.push(x);
				positions.push(y);
				positions.push(z);

				color.set(randChoise(["#93abd3", "#f2f4c0", "#9ddfd3"]));

				colors.push(color.r, color.g, color.b);
				sizes.push(1);
			}

			geometry.setAttribute(
				"position",
				new THREE.Float32BufferAttribute(positions, 3).setUsage(
					THREE.DynamicDrawUsage));


			geometry.setAttribute(
				"customColor",
				new THREE.Float32BufferAttribute(colors, 3));

			geometry.setAttribute("size", new THREE.Float32BufferAttribute(sizes, 1));

			const plane = new THREE.Points(geometry, shaderMaterial);

			plane.position.y = -8;
			scene.add(plane);
		}

		function addListners(camera, renderer, composer) {
			document.addEventListener("keydown", e => {
				const {
					x,
					y,
					z
				} = camera.position;
				console.log(`camera.position.set(${x},${y},${z})`);
				const {
					x: a,
					y: b,
					z: c
				} = camera.rotation;
				console.log(`camera.rotation.set(${a},${b},${c})`);
			});

			window.addEventListener(
				"resize",
				() => {
					const width = window.innerWidth;
					const height = window.innerHeight;

					camera.aspect = width / height;
					camera.updateProjectionMatrix();

					renderer.setSize(width,height);
					composer.setSize(width,heihgt);
					
				},
				false);

		}
	</script>

</body>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1330729.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

盲盒小程序搭建:开启互联网盲盒时代

盲盒目前是一个非常火爆的商业模式。随着科技的发展&#xff0c;盲盒市场也开始采用线上盲盒进行拓客&#xff0c;吸引盲盒爱好者。当下在互联网电商影响下&#xff0c;盲盒小程序逐渐受到了商家的青睐。 线上盲盒市场 盲盒消费主要是根据自身的未知性吸引消费者&#xff0c;消…

小白实战教学:开发同城外卖跑腿APP

本文将以"小白实战教学"为主题&#xff0c;向大家介绍如何从零开始&#xff0c;开发一款简单而实用的同城外卖跑腿APP。 一、准备工作 在开始之前&#xff0c;我们需要做一些准备工作。首先&#xff0c;确保你已经安装好了开发环境&#xff0c;包括合适的集成开发环…

09.list 容器

9、list 容器 功能&#xff1a; 将数据进行链式存储 链表&#xff08;list&#xff09;是一种物理存储单元上非连续的存储结构&#xff0c;数据元素的逻辑顺序是通过链表中的指针链接实现的 链表的组成&#xff1a; 链表由一系列结点组成 结点的组成&#xff1a; 一个是存…

携手河南恩坤德,共创养殖新篇章

在这个充满机遇与挑战的时代&#xff0c;养殖业正在经历一场前所未有的变革。作为养殖户&#xff0c;您需要一个能够与您共同应对变革、共创未来的合作伙伴。河南恩坤德农业正是这样一个值得信赖的伙伴&#xff0c;我们携手共创养殖新篇章。 河南恩坤德农业以客户需求为导向&am…

SOLIDWORKS Plastics基础功能详解(一)

Batch Manager Batch Manager PropertyManager 经过重新设计&#xff0c;提高了可用性。 在各部分中重新排列用户界面元素为 Batch Manager 提供了一个简化的工作流程。能够指定分析任务的最大 CPU 数。改进了分配给分析任务的模拟类型以及添加、运行和暂停分析任务的控件的可…

Python数据科学视频讲解:特征归一化、特征标准化、样本归一化

5.1 特征归一化、特征标准化、样本归一化 视频为《Python数据科学应用从入门到精通》张甜 杨维忠 清华大学出版社一书的随书赠送视频讲解5.1节内容。本书已正式出版上市&#xff0c;当当、京东、淘宝等平台热销中&#xff0c;搜索书名即可。内容涵盖数据科学应用的全流程&#…

nodejs+vue+ElementUi资源互助共享平台的设计

后台&#xff1a;管理员功能有个人中心&#xff0c;用户管理&#xff0c;卖家管理&#xff0c;咨询师管理&#xff0c;萌宝信息管理&#xff0c;幼儿知识管理&#xff0c;保姆推荐管理&#xff0c;音频资源管理&#xff0c;二手商品管理&#xff0c;商品分类管理&#xff0c;资…

实战经验分享:开发同城外卖跑腿小程序

下文&#xff0c;小编将与大家一同探究同城外卖跑腿小程序的开发实战&#xff0c;包括但不限于技术选型、开发流程、用户体验等多个方面。 1.技术选型 在同城外卖跑腿小程序的开发中&#xff0c;技术选型是至关重要的一环。对于前端&#xff0c;选择了使用Vue.js框架&#xff…

Qml之自定义Button

Qml之自定义Button 前言一、图标Button二、字体Button1.重写Background和ContentItem2.采用ButtonStyle前言 提示: 自定义Button控件如何分为带图片的Iconbutton和原生控件重写的Button。最终效果如下: 提示:以下是本篇文章正文内容,下面案例可供参考 一、图标Button im…

DETR 【目标检测里程碑的任务】

paper with code - DETR 标题 End-to-End Object Detection with Transformers end-to-end 意味着去掉了NMS的操作&#xff08;生成很多的预测框&#xff0c;nms 去掉冗余的预测框&#xff09;。因为有了NMS &#xff0c;所以调参&#xff0c;训练都会多了一道工序&#xff0c…

【Linux基础开发工具】gcc/g++使用make/Makefile

目录 前言 gcc/g的使用 1. 语言的发展 1.1 语言和编译器自举的过程 1.2 程序翻译的过程&#xff1a; 2. 动静态库的理解 Linux项目自动化构建工具-make/makefile 1. 快速上手使用 2. makefile/make执行顺序的理解 前言 了解完vim编辑器的使用&#xff0c;接下来就可以尝…

解决Unity物体速度过快无法进行碰撞检测(碰撞检测穿透)

解决Unity物体速度过快无法进行碰撞检测&#xff08;碰撞检测穿透&#xff09; 一、解决碰撞检测穿透方法一Collision Detection碰撞检测总结&#xff1a; 二、解决碰撞检测穿透方法二 一、解决碰撞检测穿透方法一 首先我们知道只要是跟碰撞相关的基本都是离不开刚体 Rigidbod…

海康威视运行管理中心 Fastjson RCE

漏洞描述 海康威视运行管理中心系统存在低版本Fastjson远程命令执行漏洞&#xff0c;攻击者可在未鉴权情况下获取服务器权限&#xff0c;且由于存在相关依赖&#xff0c;即使服务器不出网无法远程加载恶意类也可通过本地利用链直接命令执行&#xff0c;从而获取服务器权限。 漏…

nodejs+vue+ElementUi会员制停车场车位系统

总之&#xff0c;智能停车系统使停车场管理工作规范化&#xff0c;系统化&#xff0c;程序化&#xff0c;避免停车场管理的随意性&#xff0c;提高信息处理的速度和准确性&#xff0c;能够及时、准确、有效的查询和修改停车场情况。 三、任务&#xff1a;小组任务和个人任务 智…

vue3 登录页和路由表开发

目录 应用场景/背景描述&#xff1a; 开发流程&#xff1a; 详细开发流程&#xff1a; 总结/分析&#xff1a; 背景描述 在上一篇的基础上开始开发&#xff0c;element-plusvue3 上一篇说道详细迁移的过程&#xff0c;如下&#xff1a; 所以我这篇开始了第一步&#xff0c…

Shell编程从入门到实战

Shell 概述 &#xff08;1&#xff09;Linux 提供的 Shell 解析器有 [rootflinkTenxun ~]# cat /etc/shells&#xff08;2&#xff09;bash 和 sh 的关系 [rootflinkTenxun bin]# ll | grep bash&#xff08;3&#xff09;Centos 默认的解析器是 bash [rootflinkTenxun bin]…

从Maven初级到高级

一.Maven简介 Maven 是 Apache 软件基金会组织维护的一款专门为 Java 项目提供构建和依赖管理支持的工具。 一个 Maven 工程有约定的目录结构&#xff0c;约定的目录结构对于 Maven 实现自动化构建而言是必不可少的一环&#xff0c;就拿自动编译来说&#xff0c;Maven 必须 能…

安装nodejs,配置环境变量并将npm设置淘宝镜像源

安装nodejs并将npm设置淘宝镜像源 1. 下载nodejs 个人不喜欢安装包&#xff0c;所以是下载zip包的方式。这里我下载的node 14解压包版本 下载地址如下&#xff1a;https://nodejs.org/dist/v14.15.1/node-v14.15.1-win-x64.zip 想要其他版本的小伙伴去https://nodejs.org/di…

【C++】bind绑定包装器全解(代码演示,例题演示)

前言 大家好吖&#xff0c;欢迎来到 YY 滴C系列 &#xff0c;热烈欢迎&#xff01; 本章主要内容面向接触过C的老铁 主要内容含&#xff1a; 欢迎订阅 YY滴C专栏&#xff01;更多干货持续更新&#xff01;以下是传送门&#xff01; YY的《C》专栏YY的《C11》专栏YY的《Linux》…

7ADC模数转换器

一.模数转换原理 ADC模拟-数字转换器可以将引脚上连续变化的模拟电压转换成内存中存储的数字变量&#xff0c;建立模拟电路到数字电路的桥梁。另外一种是DAC既是与前面相反&#xff0c;如PWM波&#xff0c;由于PWM电路简单且没有额外的功率损耗&#xff0c;更适用于惯性系统的…