current position:Home>520 watch meteor shower with her on Valentine's Day ~ HTML + CSS + JavaScript make 3D photo album of meteor shower (including music)

520 watch meteor shower with her on Valentine's Day ~ HTML + CSS + JavaScript make 3D photo album of meteor shower (including music)

2021-08-22 22:54:49 @. code out the future

* 520 Watch the meteor shower with her on Valentine's Day ~html+css+javascript meteor shower 3D Photo album ( Including music )

annual /520 Valentine's Day / Valentine's day on Chinese Valentine's day / a birthday present / Confession younger martial sister / Programmer's confession , Do you want to surprise your girlfriend or your sister , Today's blog will share the front-end code html+css+javascript How to achieve 3D Three dimensional dynamic album . I quickly learned , Let's make the romance that belongs to our programmers !



* Preface

Tanabata Valentine's day ,520/ Valentine's day on Chinese Valentine's day / To marry him / 3D Photo album Programmers can also be romantic

520 Creative expression website , Let your girlfriend die for you . The goddess brought home easily

html+css+javascript Realization 3d Rotating album - Including music ,( My girlfriend for my birthday , Confession , Liao sister ), Dynamic generation effect , Tiktok: a rotated album with a very loud voice , It's made in this way ~, Now? , More and more people like to use video to record their lives , Friends with more photos will also choose to make dynamic album videos , Not only is it creative , At the same time, you can show yourself , It's a magic tool for teasing girls !


* meteor shower 3D Album Demo ( With background music )

meteor shower 3D Photo album - Online demo address

1. PC( Computer terminal ) demonstration

 Insert picture description here

Effect two

 Insert picture description here

Effect three

 Insert picture description here

2. H5( Mobile terminal ) demonstration

 Insert picture description here

* Code file directory

 Insert picture description here

One 、3D Photo album ( Code implementation )

html (3D Album section )

<body>
<!--  The music part  -->
	<audio autoplay="autopaly">
		<source src="renxi.mp3" type="audio/mp3" />
	  </audio>
	<!--  Photo album  -->
<div id="box">
	<div></div>
	<div></div>
	<div></div>
	<div></div>
	<div></div>
	<div></div>
	<div></div>
	<div></div>
	<div></div>
	<div></div>
	<p></p>
</div>
<!--  A shooting star  -->
<div class="stars">
	<div class="star"></div>
	<div class="star"></div>
	<div class="star"></div>
	<div class="star"></div>
	<div class="star"></div>
	<div class="star"></div>
	<div class="star"></div>
	<div class="star"></div>
	<div class="star"></div>
	<div class="star"></div>
	<div class="star"></div>
	<div class="star"></div>
  </div>
</body>

js ( Meteor shower part )

 <script>
setTimeout(init,100);
function init(){
    
	var obox = document.getElementById('box'),
		aDiv = obox.getElementsByTagName('div');
		
		for (var i = 0; i < aDiv.length; i++) {
    
			aDiv[i].style.background = "url(img/"+(i+1)+".jpg) center/cover";
			aDiv[i].style.transform = "rotateY("+(i*36)+"deg) translate3d(0,0,350px)";
			aDiv[i].style.transition = "transform 1s "+(aDiv.length-i)*0.2+"s";
		}
	var sX,
		sY,
		nX,
		nY,
		desX = 0,
		desY = 0,
		tX = 0,
		tY = 10,
		index = 0;// Initial value of roller 
	document.onmousedown = function(e){
    
		clearInterval(obox.timer);
		e = e || window.event;
		var sX = e.clientX,
			sY = e.clientY;
			this.onmousemove = function(e){
    
				e = e || window.event;
				var nX = e.clientX,
					nY = e.clientY;
					 //  The difference between the coordinates of the current point and the coordinates of the previous point 
					desX = nX - sX;
					desY = nY - sY;
                    tX += desX*0.1; 
                    tY += desY*0.1;

					obox.style.transform = "rotateX("+(-tY)+"deg) rotateY("+tX+"deg)";
					sX = nX;
					sY = nY;
			}
			this.onmouseup = function(){
    
				this.onmousemove = this.onmouseup = null;
				obox.timer = setInterval(function(){
    
					desX *= 0.95;
					desY *= 0.95;
					tX += desX*0.1;
					tY += desY*0.1;
					obox.style.transform = "rotateX("+(-tY)+"deg) rotateY("+tX+"deg)";
					if (Math.abs(desX)<0.5 && Math.abs(desY)<0.5) {
    
						clearInterval(obox.timer);
					}
				},13);
			}
		return false;
	}
	// The scroll wheel zooms in and out 
	mousewheel(document,function(e){
    
		e = e || window.event;
		var d = e.wheelDelta/120 || -e.detail/3;
			if (d>0) {
    
				index-=20;
			}else{
    
				index+=30;
			}
			(index<(-1050)&&(index=(-1050)));
		document.body.style.perspective = 1000 + index + "px";
	})
	function mousewheel(obj,fn){
    
		document.onmousewheel===null?obj.onmousewheel=fn:addEvent(obj,"DOMMouseScroll",fn)
	}
	function addEvent(obj,eName,fn){
    
		obj.attachEvent?obj.attachEvent("on"+eName,fn):obj.addEventListener(eName,fn);
	}
}
</script>


css (3D Album section )

		*{
    margin: 0;padding: 0;}
		html,body{
    height: 100%;}
		body{
    
			display: flex;
			perspective: 1000px;
			transform-style: preserve-3d;
			/* background-image: url(./img/3.png); */
			background: #0c0c0c;
			height:100%;
			width: 100%;
		}
		#box{
    
			z-index: 9999;
			position: relative;
			display: flex;
			width: 130px;
			height: 200px;
			margin: auto;
			transform-style: preserve-3d; 
			transform: rotateX(-10deg);
		}
		#box > div{
    
			transform-style: preserve-3d; 
			position: absolute;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			line-height: 200px;
			font-size: 50px;
			text-align: center;
			box-shadow:0 0 10px #fff;
			-webkit-box-reflect:below 10px -webkit-linear-gradient(top,rgba(0,0,0,0) 40%,rgba(0,0,0,.8) 100%);
		}
		
		#box p{
    
			position: absolute;
			left: 0;
			top: 0;
			bottom: 0;
			right: 0;
			margin: auto;
			width: 1200px;
			height: 1200px;
			background: -webkit-radial-gradient(center center,600px 600px,rgba(50,50,50,1),rgba(0,0,0,0));
			border-radius: 50%;
			transform: rotateX(90deg) translate3d(-600px,0,-105px);
		}
		/*  Rain effects  */
			#codepen-link {
    
				position: absolute;
				bottom: 30px;
				right: 30px;
				height: 40px;
				width: 40px;
				z-index: 10;
				border-radius: 50%;
				box-sizing: border-box;
				background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/544318/logo.jpg");
				background-position: center center;
				background-size: cover;
				opacity: 0.5;
				-webkit-transition: all 0.25s;
				transition: all 0.25s;
			}
	
			#codepen-link:hover {
    
				opacity: 0.8;
				box-shadow: 0 0 6px #efefef;
			}

Two 、3D Album replacement ( course )

The tutorial is as follows : First of all, you need to prepare 10 A picture can be cut without cutting , The image format is .jpg Don't be wrong

 Insert picture description here

3、 ... and 、 song mp3 Replace tutorial ( course )

If it needs to be replaced mp3 The background music , You can download and replace it by yourself ~ mp3 Free download address
1. Search for songs you need

 Insert picture description here

2. download
 Insert picture description here

3 Get songs id
 Insert picture description here

4 Pay attention to the official account. / Copy link to browser open

 Insert picture description here

5 download mp3 ~ After downloading, replace it by yourself mp3 File can ( If you don't want to modify the code , The name must be consistent )
 Insert picture description here


Four 、 Good web effect , How to send links to others ?

1.1 Solve the deployment online ~> Deploy online tools ( It can be used permanently and free of charge )

1. You don't need to buy a server to deploy online , Your connection is accessible all over the world , Here is a necessary artifact for programmers ~
Plugins are integrated with super easy-to-use plug-ins , Download and install for free , Simple and easy to understand , It's an artifact ~ If necessary, it can be found in the article ↓ Xiagong Z Number acquisition

2. Is to do your code effect well , Deploy online , Send links to others , You can let the other party click in through your connection , You can see the effect of your web page , Both computer and mobile terminals are OK ! ( Otherwise, people will send files when they see your web page , The experience is not very good ~)

1.1 Deployment process

 Insert picture description here

1.2 wow ~ Deployment success

wow ~ Deployment success ! Deploy your written page online , People all over the world can access your web page through links ( Free forever )~
 Insert picture description here


5、 ... and 、 front end Zero basis Entry to advanced ( video + Source code + Development software + Learning materials + Interview questions ) a full set of ( course )

Suitable for children's shoes from entry to advanced ~
 Insert picture description here


6、 ... and 、* The source code for

* ~ Pay attention to me , Like the blog ~ Every day brings you knowledge !

* 1. See here, just [ give the thumbs-up + Praise + Collection ] Three even ~ Support me , Yours 「 give the thumbs-up , Praise , Collection 」 It's the driving force of my creation .

* 2. Pay attention to me ~ Take you to study every day : Various front-end plug-ins 、3D Cool effect 、 Pictures show 、 Text effect 、 And the whole station template 、 College graduation template 、 Final assignment template 、 etc. ! 「 There are a lot of front end developer , To discuss front end Node knowledge , learn from each other 」!

* 3. We can learn from each other about the above technical issues , can Focus on ↓ Male Z Number Get more source code !

 Insert picture description here


7、 ... and 、* More confession source code

100 Paragraph confession source code demonstration address

copyright notice
author[@. code out the future],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2021/08/20210822225447605w.html

Random recommended