3d爱心粒子实现爱心表白源码(免费分享)html

HTML代码

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>	
	<style>
	
		html, body {
		  height: 100%;
		  padding: 0;
		  margin: 0;
		  background: #000;
		}
		img{
			display: block;
			margin: 0 auto;
		}
		label{
			
			display: block;
			margin: 0 auto;
			color: pink;
			font-size: 20px;
			padding-right: 5px;/*往左偏移10px*/
			animation:mymove 2.5s infinite;/* //关联动画名称、动画时长、循环 */
				/*Safari 和 Chrome:*/
				-webkit-animation:mymove 2.5s infinite;/* //同上(兼容) */
		}
		@keyframes mymove
			{
			50% {font-size: 40px;}/* //名字放大大小 */
		}
		
		/*Safari 和 Chrome:*/
		@-webkit-keyframes mymove
		{
			50% {font-size: 40px;}/* //名字放大大小 */
		}
		.middle{
			width: 100%;
			height: 100vh;
			display: flex;
			align-items: center;
		}
		.middle2{
			position: absolute;
			z-index: 2;
			width: 100%;
			height: 100%;
            margin: auto;
全部源码+企鹅群:927657087

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的3D粒子爱心代码HTML源码: ```html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>3D粒子爱心效果</title> <style> body { margin: 0; padding: 0; overflow: hidden; background-color: #000; } canvas { display: block; } </style> </head> <body> <canvas id="canvas"></canvas> <script> var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); var W = canvas.width = window.innerWidth; var H = canvas.height = window.innerHeight; var particleCount = 200; var particles = []; function Particle() { this.x = Math.random() * W; this.y = Math.random() * H; this.vx = Math.random() * 20 - 10; this.vy = Math.random() * 20 - 10; this.gravity = 0.3; this.alpha = Math.random(); this.color = 'rgb(' + Math.floor(Math.random() * 255) + ',' + Math.floor(Math.random() * 255) + ',' + Math.floor(Math.random() * 255) + ')'; } Particle.prototype.draw = function() { ctx.globalAlpha = this.alpha; ctx.fillStyle = this.color; ctx.beginPath(); ctx.arc(this.x, this.y, 5, 0, Math.PI * 2, false); ctx.fill(); }; function init() { for (var i = 0; i < particleCount; i++) { particles.push(new Particle()); } } function update() { ctx.clearRect(0, 0, W, H); for (var i = 0; i < particleCount; i++) { var p = particles[i]; p.vy += p.gravity; p.x += p.vx; p.y += p.vy; if (p.x > W || p.x < 0 || p.y > H || p.y < 0) { particles[i] = new Particle(); } p.draw(); } } init(); setInterval(update, 1000 / 60); </script> </body> </html> ``` 这个代码使用了HTML5的Canvas标签和JavaScript来实现3D粒子爱心效果。它通过在Canvas上绘制大量的带有随机颜色和透明度的小圆点来模拟出一个3D爱心效果。通过改变圆点的位置和速度,可以让它们在屏幕上自由运动,从而创造出动态的效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值