❤ 十个拿来就能用的网页炫酷特效

效果如下:

(1) 鼠标点击爱心

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title>
</head><body><h2>网页部分</h2><!-- 网页鼠标点击特效(爱心) --><script type="text/javascript">window.onload= ! function (e, t, a) {function r() {for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x +"px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");requestAnimationFrame(r)}function n() {var t = "function" == typeof e.onclick && e.onclick;e.onclick = function (e) {t && t(), o(e)}}function o(e) {var a = t.createElement("div");a.className = "heart", s.push({el: a,x: e.clientX - 5,y: e.clientY - 5,scale: 1,alpha: 1,color: c()}), t.body.appendChild(a)}function i(e) {var a = t.createElement("style");a.type = "text/css";try {a.appendChild(t.createTextNode(e))} catch (t) {a.styleSheet.cssText = e}t.getElementsByTagName("head")[0].appendChild(a)}function c() {return "rgb(" + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + ")"}var s = [];e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function (e) {setTimeout(e, 1e3 / 60)}, i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"), n(), r()}(window, document);</script>
</body></html>

(2) 鼠标点击文字


<!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><style>* {margin: 0;padding: 0;box-sizing: border-box;}div {height: 100vh;}</style><script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
</head>
<body style="width: 100%;height: 100%;"><div></div><script type="text/javascript">var a_idx = 0;jQuery(document).ready(function ($) {$("body").click(function (e) {var a = new Array("❤富强❤", "❤民主❤", "❤文明❤", "❤和谐❤", "❤自由❤", "❤平等❤", "❤公正❤", "❤法治❤", "❤爱国❤","❤敬业❤", "❤诚信❤", "❤友善❤");var $i = $("<span/>").text(a[a_idx]);a_idx = (a_idx + 1) % a.length;var x = e.pageX,y = e.pageY;$i.css({"z-index": 9999999999999999999999999999999999999999999999999999,"top": y - 20,"left": x,"position": "absolute","font-weight": "bold","color": "#ff6651"});$("body").append($i);$i.animate({"top": y - 180,"opacity": 0},1800,function () {$i.remove();});});});</script>
</body>
</html>

(3) 烟花波纹


<html>
<head></head>
<body>
<script>
function clickEffect() {let balls = [];let longPressed = false;let longPress;let multiplier = 0;let width, height;let origin;let normal;let ctx;const colours = ["#F73859", "#14FFEC", "#00E0FF", "#FF99FE", "#FAF15D"];const canvas = document.createElement("canvas");document.body.appendChild(canvas);canvas.setAttribute("style", "width: 100%; height: 100%; top: 0; left: 0; z-index: 99999; position: fixed; pointer-events: none;");const pointer = document.createElement("span");pointer.classList.add("pointer");document.body.appendChild(pointer);if (canvas.getContext && window.addEventListener) {ctx = canvas.getContext("2d");updateSize();window.addEventListener('resize', updateSize, false);loop();window.addEventListener("mousedown", function(e) {pushBalls(randBetween(10, 20), e.clientX, e.clientY);document.body.classList.add("is-pressed");longPress = setTimeout(function(){document.body.classList.add("is-longpress");longPressed = true;}, 500);}, false);window.addEventListener("mouseup", function(e) {clearInterval(longPress);if (longPressed == true) {document.body.classList.remove("is-longpress");pushBalls(randBetween(50 + Math.ceil(multiplier), 100 + Math.ceil(multiplier)), e.clientX, e.clientY);longPressed = false;}document.body.classList.remove("is-pressed");}, false);window.addEventListener("mousemove", function(e) {let x = e.clientX;let y = e.clientY;pointer.style.top = y + "px";pointer.style.left = x + "px";}, false);} else {console.log("canvas or addEventListener is unsupported!");}function updateSize() {canvas.width = window.innerWidth * 2;canvas.height = window.innerHeight * 2;canvas.style.width = window.innerWidth + 'px';canvas.style.height = window.innerHeight + 'px';ctx.scale(2, 2);width = (canvas.width = window.innerWidth);height = (canvas.height = window.innerHeight);origin = {x: width / 2,y: height / 2};normal = {x: width / 2,y: height / 2};}class Ball {constructor(x = origin.x, y = origin.y) {this.x = x;this.y = y;this.angle = Math.PI * 2 * Math.random();if (longPressed == true) {this.multiplier = randBetween(14 + multiplier, 15 + multiplier);} else {this.multiplier = randBetween(6, 12);}this.vx = (this.multiplier + Math.random() * 0.5) * Math.cos(this.angle);this.vy = (this.multiplier + Math.random() * 0.5) * Math.sin(this.angle);this.r = randBetween(8, 12) + 3 * Math.random();this.color = colours[Math.floor(Math.random() * colours.length)];}update() {this.x += this.vx - normal.x;this.y += this.vy - normal.y;normal.x = -2 / window.innerWidth * Math.sin(this.angle);normal.y = -2 / window.innerHeight * Math.cos(this.angle);this.r -= 0.3;this.vx *= 0.9;this.vy *= 0.9;}}function pushBalls(count = 1, x = origin.x, y = origin.y) {for (let i = 0; i < count; i++) {balls.push(new Ball(x, y));}}function randBetween(min, max) {return Math.floor(Math.random() * max) + min;}function loop() {ctx.fillStyle = "rgba(255, 255, 255, 0)";ctx.clearRect(0, 0, canvas.width, canvas.height);for (let i = 0; i < balls.length; i++) {let b = balls[i];if (b.r < 0) continue;ctx.fillStyle = b.color;ctx.beginPath();ctx.arc(b.x, b.y, b.r, 0, Math.PI * 2, false);ctx.fill();b.update();}if (longPressed == true) {multiplier += 0.2;} else if (!longPressed && multiplier >= 0) {multiplier -= 0.4;}removeBall();requestAnimationFrame(loop);}function removeBall() {for (let i = 0; i < balls.length; i++) {let b = balls[i];if (b.x + b.r < 0 || b.x - b.r > width || b.y + b.r < 0 || b.y - b.r > height || b.r < 0) {balls.splice(i, 1);}}}
}
clickEffect();//调用特效函数
</script>
</body>
</html>

(4) 鼠标星星

 <script>(function fairyDustCursor() {var possibleColors = ["#D61C59", "#E7D84B", "#1B8798"]var width = window.innerWidth;var height = window.innerHeight;var cursor = { x: width / 2, y: width / 2 };var particles = [];function init() {bindEvents();loop();}// Bind events that are neededfunction bindEvents() {document.addEventListener('mousemove', onMouseMove);window.addEventListener('resize', onWindowResize);}function onWindowResize(e) {width = window.innerWidth;height = window.innerHeight;}function onMouseMove(e) {cursor.x = e.clientX;cursor.y = e.clientY;addParticle(cursor.x, cursor.y, possibleColors[Math.floor(Math.random() * possibleColors.length)]);}function addParticle(x, y, color) {var particle = new Particle();particle.init(x, y, color);particles.push(particle);}function updateParticles() {// Updatedfor (var i = 0; i < particles.length; i++) {particles[i].update();}// Remove dead particlesfor (var i = particles.length - 1; i >= 0; i--) {if (particles[i].lifeSpan < 0) {particles[i].die();particles.splice(i, 1);}}}function loop() {requestAnimationFrame(loop);updateParticles();}/*** Particles*/function Particle() {this.character = "*";this.lifeSpan = 120; //msthis.initialStyles = {"position": "fixed","display": "inline-block","top": "0px","left": "0px","pointerEvents": "none","touch-action": "none","z-index": "10000000","fontSize": "25px","will-change": "transform"};// Init, and set propertiesthis.init = function (x, y, color) {this.velocity = {x: (Math.random() < 0.5 ? -1 : 1) * (Math.random() / 2),y: 1};this.position = { x: x + 10, y: y + 10 };this.initialStyles.color = color;this.element = document.createElement('span');this.element.innerHTML = this.character;applyProperties(this.element, this.initialStyles);this.update();document.querySelector('.js-cursor-container').appendChild(this.element);};this.update = function () {this.position.x += this.velocity.x;this.position.y += this.velocity.y;this.lifeSpan--;this.element.style.transform = "translate3d(" + this.position.x + "px," + this.position.y + "px, 0) scale(" + (this.lifeSpan / 120) + ")";}this.die = function () {this.element.parentNode.removeChild(this.element);}}/*** Utils*/// Applies css `properties` to an element.function applyProperties(target, properties) {for (var key in properties) {target.style[key] = properties[key];}}if (!('ontouchstart' in window || navigator.msMaxTouchPoints)) init();})();    </script>

(4) 鼠标粒子拖尾

(5) 鼠标粒子拖尾

<body><script src="./js/6smile1.js"></script><!--光标特效仙女棒--><script src="./js/6smile2.js"></script><!--光标之泡泡--><script src="./js/6smile3.js"></script><!--笑脸--><script src="./js/6smile4.js"></script><!--雪花--><script src="./js/6smile5.js"></script><!-- 点击后出现烟花效果 --><!--光标特效仙女棒--><!--  <script src="https://blog-static.cnblogs.com/files/axqa/fairyDustCursor.js"></script> --><!--光标之泡泡--><!-- <script src="https://blog-static.cnblogs.com/files/axqa/bubbleCursor.js"></script> --><!--笑脸--><!--  <script src="https://blog-static.cnblogs.com/files/axqa/emojiCursor.js"></script> --><!--雪花--><!--   <script src="https://blog-static.cnblogs.com/files/axqa/snowflakeCursor.js"></script> --><!-- 点击后出现烟花效果 --><!--  <script src="https://blog-static.cnblogs.com/files/axqa/cursor-effects.js"></script> --></body>

(7) 樱花效果

(8) 蜘蛛网

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title>
</head><body>
<script>!function () {function n(n, e, t) {return n.getAttribute(e) || t}function e(n) {return document.getElementsByTagName(n)}function t() {var t = e("script"), o = t.length, i = t[o - 1];return {l: o, z: n(i, "zIndex", -1), o: n(i, "opacity", .5), c: n(i, "color", "0,0,0"), n: n(i, "count", 99)}}function o() {a = m.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, c = m.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight}function i() {r.clearRect(0, 0, a, c);var n, e, t, o, m, l;s.forEach(function (i, x) {for (i.x += i.xa, i.y += i.ya, i.xa *= i.x > a || i.x < 0 ? -1 : 1, i.ya *= i.y > c || i.y < 0 ? -1 : 1, r.fillRect(i.x - .5, i.y - .5, 1, 1), e = x + 1; e < u.length; e++) n = u[e], null !== n.x && null !== n.y && (o = i.x - n.x, m = i.y - n.y, l = o * o + m * m, l < n.max && (n === y && l >= n.max / 2 && (i.x -= .03 * o, i.y -= .03 * m), t = (n.max - l) / n.max, r.beginPath(), r.lineWidth = t / 2, r.strokeStyle = "rgba(" + d.c + "," + (t + .2) + ")", r.moveTo(i.x, i.y), r.lineTo(n.x, n.y), r.stroke()))}), x(i)}var a, c, u, m = document.createElement("canvas"), d = t(), l = "c_n" + d.l, r = m.getContext("2d"),x = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (n) {window.setTimeout(n, 1e3 / 45)}, w = Math.random, y = {x: null, y: null, max: 2e4};m.id = l, m.style.cssText = "position:fixed;top:0;left:0;z-index:" + d.z + ";opacity:" + d.o, e("body")[0].appendChild(m), o(), window.onresize = o, window.onmousemove = function (n) {n = n || window.event, y.x = n.clientX, y.y = n.clientY}, window.onmouseout = function () {y.x = null, y.y = null};for (var s = [], f = 0; d.n > f; f++) {var h = w() * a, g = w() * c, v = 2 * w() - 1, p = 2 * w() - 1;s.push({x: h, y: g, xa: v, ya: p, max: 6e3})}u = s.concat([y]), setTimeout(function () {i()}, 100)}();
</script>
</body></html>

(9) 看板娘

(10) 烟花

(11) 星星背景

需要的可以留言或者

资源地址:
链接
https://download.csdn.net/download/weixin_43615570/87824825?spm=1001.2014.3001.5503

❤ 十一个拿来就能用的网页炫酷特效相关推荐

  1. 我是Python小玩家,一行代码能做哪些炫酷的事情 (三十一)

    文章目录 python之禅 一行代码启动一个Web服务 一行代码实现变量值互换 一行代码打印迷宫 解决FizzBuzz问题 一行代码输出特定字符"Love"拼成的心形 一行代码输出 ...

  2. 六十一、2021 - 年终总结(正在拼搏奋斗的酷涛)

    ✨时光飞逝,不知不觉,在忙忙碌碌中一年又戛然而止,回头看看这一年既欣慰又慨叹,虽然现在只是一个刚入门的小白,仅仅两年,但这两年足够改变一个人对生活的看法和态度,临近跨年,对自己进行一个系统性的总结,还 ...

  3. 【Unity3D Shader编程】之十一 深入理解Unity5中的Standard Shader(三)屏幕像素化特效的实现

    本系列文章由@浅墨_毛星云 出品,转载请注明出处.    文章链接:  http://blog.csdn.net/poem_qianmo/article/details/50095705 作者:毛星云 ...

  4. idea常用的一些配置信息

    说明:此配置均基于idea2021.3.3 版本 目录 一.设置主题背景 二.设置Eclipse快捷键 1.类文件的查找和控制台的查找 三.设置超出屏幕宽度自动换行 四.自动导包import设置 五. ...

  5. 影像篡改与识别(二):数字时代

    1997年,埃及哈特谢普苏特神庙前,一张恐怖组织持枪扫射游客后的新闻图片被爆造假: 2006年,以色列空袭黎巴嫩首都贝鲁特,一张浓烟笼罩城市的照片被证实是伪造的: 2008年,一张伊朗试射多枚远程导弹 ...

  6. 安卓技术文章集合—184篇文章分类汇总

    View篇: UI特效之酷炫抢红包金币下落动画 http://mp.weixin.qq.com/s?__biz=MzI3OTU0MzI4MQ==&mid=2247484357&idx= ...

  7. 2017上半年技术文章集合—184篇文章分类汇总

    声明 | 作者 :于亚豪 | 原创 | 终端研发部 前言: 2017年已经过大半,公众号里技术文章整理和归类了一下,方便给大家查找和阅读.这也是目前 发文的一个统计. View篇: 高级UI特效之酷炫 ...

  8. 2020年工作生活总结

    2020年最后一天. 要写这一年的工作总结,我怕是写不出来两句,还好带有生活二字,我还是能唠叨几句的. 2020年在工作上,话说这一年我一共就工作了三四个月,不算请假的话也就三个月,可以说今年白干,到 ...

  9. 2017上半年技术文章集合【Android】—184篇文章分类汇总

    地址: mp.weixin.qq.com/ 声明 | 本文是于亚豪 原创 终端研发部 前言: 2017年已经过大半,公众号里技术文章整理和归类了一下,方便给大家查找和阅读.这也是目前 发文的一个统计. ...

最新文章

  1. 虚拟机磁盘类型_虚拟机存储类型分为哪些种类
  2. 面向对象的三个基本特征 和 五种设计原则
  3. java如何保存初始化数据_java – 如何在JUnit测试中初始化数据
  4. better-scroll 的介绍
  5. MySQL之事务隔离级别--转载
  6. JavaScript 常用函数总结
  7. application.properties引用其他文件_金橙智能 | C语言头文件组织与包含原则,你知道吗?...
  8. 1031:反向输出一个三位数
  9. Java输出小明算对多少题目_2014年Java方向C组第十题
  10. oracle DB_LINK
  11. 大岩俊之实用性阅读指南pdf_《实用性阅读指南》:二八法则、笔记法......开启你的阅读技能...
  12. Nancy 框架学习
  13. 分治法 —— 快速排序和归并排序(自底向上和自顶向下)
  14. linux根文件系统树制作
  15. 【转】非教育网中IPv4网络访问IPv6资源
  16. thinkphp + 腾讯云名片识别
  17. director(director)
  18. 心阶ssr上不去_高中数学成绩上不去的“九宗罪”!附经典数学题50道
  19. 台式计算机一般多大功率,电脑的功率有多大,台式电脑的功率是多少
  20. x86 LEA 指令

热门文章

  1. 为什么需要进行性能测试?
  2. 2021-2025年中国家用电器消耗品行业市场供需与战略研究报告
  3. 电子商务主要学什么?
  4. npm install xxxx --legacy-peer-deps命令是什么?为什么可以解决下载时候产生的依赖冲突呢?
  5. HTML5 图片边框
  6. 《神经网络与深度学习》学习笔记二
  7. 天池赛:工业蒸汽量预测
  8. 封装、抽象、继承、多态
  9. 【专题】C#调用动态链接库DLL
  10. Django 2.1.3 视图层 内置CBV通用视图