文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

十个利用JavaScript实现的爱心动画特效

2024-04-02 19:55

关注

3d爱心跳动特效

效果展示

代码展示

<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Beating heart ❤</title>

<link rel="stylesheet" href="css/style.css" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" >

</head>
<body>


<script src='js/three.min.js'></script>
<script src='js/MeshSurfaceSampler.js'></script>
<script src='js/TrackballControls.js'></script>
<script src='js/simplex-noise.js'></script>
<script src='js/OBJLoader.js'></script>
<script src='js/gsap.min.js'></script>
<script src="js/script.js"></script>

</body>
</html>

线条合成的爱心动画特效

效果展示

代码展示

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

<head>
  <meta charset="UTF-8">
  <title>Forming  Colorful Heart</title>
      <link rel="stylesheet" href="css/style.css" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" >
</head>

<body>
  <canvas width="300" height="300" style="width:100%;height:100vh;" id="c"></canvas>
    <script  src="js/index.js"></script>
</body>
</html>

520爱心背景表白网页动画特效

效果展示

代码展示

<div class="star"><div class="heart animated"></div></div>

<script type="application/javascript" src="js/main.js"></script>
<script>
document.body.addEventListener('touchmove', function(e){
        e.preventDefault();
    }, { passive: false });  //passive 参数不能省略,用来兼容ios和android
	function star(){
		$('.star').fadeIn();
		setTimeout(function(){
			$('.star').fadeOut()
		},1000)
	}
    
	function playMusic(obj) {
        var player = $("#player")[0]; 
        if (player.paused){ 
            player.play(); 
            $(obj).addClass('musicRotate');
            $(obj).attr('src','img/musicP.png')
        }else {
            player.pause();
            $(obj).removeClass('musicRotate');
            $(obj).attr('src','img/musicS.png')
        }
    }
</script>

爱心签到墙

效果展示

代码展示

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>CSS3实现照片墙</title>
	<link href="css/style.css" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  type="text/css" rel="stylesheet">
</head>

<body>

	<div class="container" id="container"></div>
	
	<script src="js/jquery-1.11.1.min.js"></script>
	<script>
		$(function () {
			var count = 0;
			var selectFlag = false;
			var startFlag = false;
			var roundBox;
			$("#container").css("width", window.innerHeight * 4 / 3)
			var appendPic = function (item) {
				if (selectFlag) {
					return
				}
				var x = Math.random() * 4,
					y = Math.random() * 4
				if (!heartFunc(x, y)) {
					appendPic(item)
				} else {
					var back = "jpg";
					var imgNum = 10;
					if (item % imgNum == 1) {
						back = "gif"
					}
					if (item % imgNum == 2 || item % imgNum == 3 || item % imgNum == 4) {
						back = "png"
					}
					var html = '<img src="img/img' + item % imgNum + '.' + back + '" class="picBase" id="pic-' + item + '"  />'
					$("#container").append(html)
					setTimeout(function () {
						$("#pic-" + item).css("top", 45 + 25 * (2 - y) * 0.85 + "%").css("left", 50 + 25 * (2 - x) * 0.85 + "%")
							.css("transform", "rotate("+(25 * (0.5 - Math.random())) + "deg) translate(-50%,-50%)")
							.css("width", "100px").css("height", "100px")
					}, 500);

				}

			}
</script>

粉色的情人节爱心飞出ui特效

效果展示

代码展示

<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>CodePen - mellomelloMellow - created by pure JavaScript and canvas</title>
<link rel="stylesheet" href="css/style.css" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" >

</head>
<body>

<div id="contents">
<canvas id="canvas">This browser cannot use a canvas.</canvas>
</div>

<script src="js/script.js"></script>

</body>
</html>

酷炫表白爱心动画特效

效果展示

代码展示

<head>
        <title>小瑞</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <style>
            body {
                font-family: Monospace;
                background-color: #f0f0f0;
                margin: 0px;
                overflow: hidden;
            }
        </style>
    </head>
    <body>


        <script src="js/nb.js"></script>

        <script src="js/Projector.js"></script>
        <script src="js/CanvasRenderer.js"></script>

        <script src="js/tween.min.js"></script>
        <script src="js/Sparks.js"></script>

        <!-- load the font file from canvas-text -->

        <script src="js/helvetiker_regular.typeface.js"></script>

烂漫爱心表白动画(程序员也浪漫)

效果展示

代码展示

<link href="css/default.css" rel="external nofollow"  type="text/css" rel="stylesheet">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/garden.js"></script>
<script type="text/javascript" src="js/functions.js"></script>

</head>

<body>

<div id="mainDiv">
	<div id="content">
		<div id="code">
			<span class="comments"></span><br />
			Boy name = <span class="keyword">Mr</span> LI<br />
			Girl name = <span class="keyword">Mrs</span> ZHANG<br />
			<span class="comments">// Fall in love river. </span><br />
			The boy love the girl;<br />
			<span class="comments">// They love each other.</span><br />
			The girl loved the boy;<br />
			<span class="comments">// AS time goes on.</span><br />
			The boy can not be separated the girl;<br />
			<span class="comments">// At the same time.</span><br />
			The girl can not be separated the boy;<br />
			<span class="comments">// Both wind and snow all over the sky.</span><br />
			<span class="comments">// Whether on foot or 5 kilometers.</span><br />
			<span class="keyword">The boy</span> very <span class="keyword">happy</span>;<br />
			<span class="keyword">The girl</span> is also very <span class="keyword">happy</span>;<br />
			<span class="placeholder"/><span class="comments">// Whether it is right now</span><br />
			<span class="placeholder"/><span class="comments">// Still in the distant future.</span><br />
			<span class="placeholder"/>The boy has but one dream;<br />
			<span class="comments">// The boy wants the girl could well have been happy.</span><br />
			<br>
			<br>
			I want to say:<br />
			Baby, I love you forever;<br />
		</div>

飘落的爱心雨

效果展示

代码展示

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>爱心雨</title>

<style>
body {
	overflow: hidden;
	margin: 0 auto;
	background: url('img/16.jpg') no-repeat; 
	background-attachment:fixed;
	background-size:cover; 
	-moz-background-size:cover; 
	-webkit-background-size:cover;
}

.snowfall-flakes:before {
	content: "";
	
	position: absolute;
	left: 0px;
	top: 0px;
	width: 10px;
	height: 16px;
	transform: rotate(-45deg);
	background-color: red;
	border-radius: 5px 5px 1px 1px;
}

.snowfall-flakes:after {
	content: ""; 
	position: absolute;
	left: 0px;
	top: 0px;
	width: 10px;
	height: 16px;
	transform: translateX(4.3px) rotate(45deg);
	background-color: red;
	border-radius: 5px 5px 1px 1px;
}
</style>

线条的3D爱心动画

效果展示

代码展示

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HTML5 3D爱心动画DEMO演示</title>

<link rel="stylesheet" href="css/normalize.css" rel="external nofollow" >


<!--主要样式-->
<link rel="stylesheet" href="css/style.css" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  media="screen" type="text/css" />

</head>

<body>

<div class='heart3d'>
	<div class='rib1'></div>
	<div class='rib2'></div>
	<div class='rib3'></div>
	<div class='rib4'></div>
	<div class='rib5'></div>
	<div class='rib6'></div>
	<div class='rib7'></div>
	<div class='rib8'></div>
	<div class='rib9'></div>
	<div class='rib10'></div>
	<div class='rib11'></div>
	<div class='rib12'></div>
	<div class='rib13'></div>
	<div class='rib14'></div>
	<div class='rib15'></div>
	<div class='rib16'></div>
	<div class='rib17'></div>
	<div class='rib18'></div>
	<div class='rib19'></div>
	<div class='rib20'></div>
	<div class='rib21'></div>
	<div class='rib22'></div>
	<div class='rib23'></div>
	<div class='rib24'></div>
	<div class='rib25'></div>
	<div class='rib26'></div>
	<div class='rib27'></div>
	<div class='rib28'></div>
	<div class='rib29'></div>
	<div class='rib30'></div>
	<div class='rib31'></div>
	<div class='rib32'></div>
	<div class='rib33'></div>
	<div class='rib34'></div>
	<div class='rib35'></div>
	<div class='rib36'></div>
</div>

</body>
</html>

原生JS制作爱心表白代码

效果展示

代码展示

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>心心-样例图</title>

<link href="favicon.ico" rel="external nofollow"  rel="shortcut icon" class="icon-love" type="images/x-ico">

<link rel="stylesheet" href="css/love.css" rel="external nofollow" >

</head>
<body>

<div class="container" onselectstart="return false;" unselectable="on" style="-moz-user-select:none;">

    <div class="body_left">
        <img src="images/biubiubiu.gif" alt="" ondragstart='return false;'>
    </div>

    <div class="body_center love">
        <div class="block">
            <div class="div1"></div>
            <div class="div2"></div>
            <div class="div3"></div>
            <div class="div4"></div>
        </div>
    </div>

</div>

<div class="footer">
    <div class="border">
        <div class="border-top"></div>
        <div class="border-bottom"></div>
    </div>

    <div class="copyright">
        <div id="version"><span>Version:</span>&nbsp;0.0.2</div>
        <div id="createTime"><span>Time:</span>&nbsp;2019/4/17</div>
        <div id="author"><span>&copy;&nbsp;</span>xianchenxy</div>
    </div>
</div>

<script type="text/javascript" src="js/love.js"></script>

</body>
</html>

以上就是十个利用JavaScript实现的爱心动画特效的详细内容,更多关于JavaScript爱心动画特效的资料请关注编程网其它相关文章!

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-前端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯