抖音爱心特效代码

article/2025/8/20 17:10:03

这是效果

在这里插入图片描述
这代码文件的百度网盘链接:
链接:https://pan.baidu.com/s/1uZmPcoesCifI5GqsT8NeOQ
提取码:1234

第一步新建文本文件,命名为loveme,随便写

在这里插入图片描述
打开文本文件把最下面代码复制到txt文件里面,把第4行和32行张小名改为你喜欢人的名字就好。
如下是设置爱心中间的文字属性的注释,在最下面代码的21到27行:

.child{position: relative;				top:45%;<!--文字上下对齐的比列,可以理解为垂直居中的比例-->text-align: center;<!--文字居中-->font-size: 18px;<!--文字大小-->color:#EA80B0;	<!--文字颜色-->			
}

再把文件名后缀改为html格式回车

在这里插入图片描述

双击自动选择浏览器打开,或者在打开方式选择你的浏览器打开

在这里插入图片描述

完整代码如下

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE> 张小名爱你(づ ̄3 ̄)づ╭❤~</TITLE><META NAME="Generator" CONTENT="EditPlus"><META NAME="Author" CONTENT=""><META NAME="Keywords" CONTENT=""><META NAME="Description" CONTENT=""><style>html, body {height: 100%;padding: 0;margin: 0;background: #000;
}
canvas {position: absolute;width: 100%;height: 100%;
}.child{position: relative;				top:45%;text-align: center;font-size: 18px;color:#EA80B0;				}</style></HEAD><BODY><div class="child">张小名我LOVE你(づ ̄3 ̄)づ╭❤~</div><canvas id="pinkboard"></canvas><script>/** Settings*/
var settings = {particles: {length:   500, // maximum amount of particlesduration:   2, // particle duration in secvelocity: 100, // particle velocity in pixels/seceffect: -0.75, // play with this for a nice effectsize:      30, // particle size in pixels},
};/** RequestAnimationFrame polyfill by Erik Möller*/
(function(){var b=0;var c=["ms","moz","webkit","o"];for(var a=0;a<c.length&&!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[c[a]+"CancelAnimationFrame"]||window[c[a]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f)},f);b=d+f;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());/** Point class*/
var Point = (function() {function Point(x, y) {this.x = (typeof x !== 'undefined') ? x : 0;this.y = (typeof y !== 'undefined') ? y : 0;}Point.prototype.clone = function() {return new Point(this.x, this.y);};Point.prototype.length = function(length) {if (typeof length == 'undefined')return Math.sqrt(this.x * this.x + this.y * this.y);this.normalize();this.x *= length;this.y *= length;return this;};Point.prototype.normalize = function() {var length = this.length();this.x /= length;this.y /= length;return this;};return Point;
})();/** Particle class*/
var Particle = (function() {function Particle() {this.position = new Point();this.velocity = new Point();this.acceleration = new Point();this.age = 0;}Particle.prototype.initialize = function(x, y, dx, dy) {this.position.x = x;this.position.y = y;this.velocity.x = dx;this.velocity.y = dy;this.acceleration.x = dx * settings.particles.effect;this.acceleration.y = dy * settings.particles.effect;this.age = 0;};Particle.prototype.update = function(deltaTime) {this.position.x += this.velocity.x * deltaTime;this.position.y += this.velocity.y * deltaTime;this.velocity.x += this.acceleration.x * deltaTime;this.velocity.y += this.acceleration.y * deltaTime;this.age += deltaTime;};Particle.prototype.draw = function(context, image) {function ease(t) {return (--t) * t * t + 1;}var size = image.width * ease(this.age / settings.particles.duration);context.globalAlpha = 1 - this.age / settings.particles.duration;context.drawImage(image, this.position.x - size / 2, this.position.y - size / 2, size, size);};return Particle;
})();/** ParticlePool class*/
var ParticlePool = (function() {var particles,firstActive = 0,firstFree   = 0,duration    = settings.particles.duration;function ParticlePool(length) {// create and populate particle poolparticles = new Array(length);for (var i = 0; i < particles.length; i++)particles[i] = new Particle();}ParticlePool.prototype.add = function(x, y, dx, dy) {particles[firstFree].initialize(x, y, dx, dy);// handle circular queuefirstFree++;if (firstFree   == particles.length) firstFree   = 0;if (firstActive == firstFree       ) firstActive++;if (firstActive == particles.length) firstActive = 0;};ParticlePool.prototype.update = function(deltaTime) {var i;// update active particlesif (firstActive < firstFree) {for (i = firstActive; i < firstFree; i++)particles[i].update(deltaTime);}if (firstFree < firstActive) {for (i = firstActive; i < particles.length; i++)particles[i].update(deltaTime);for (i = 0; i < firstFree; i++)particles[i].update(deltaTime);}// remove inactive particleswhile (particles[firstActive].age >= duration && firstActive != firstFree) {firstActive++;if (firstActive == particles.length) firstActive = 0;}};ParticlePool.prototype.draw = function(context, image) {// draw active particlesif (firstActive < firstFree) {for (i = firstActive; i < firstFree; i++)particles[i].draw(context, image);}if (firstFree < firstActive) {for (i = firstActive; i < particles.length; i++)particles[i].draw(context, image);for (i = 0; i < firstFree; i++)particles[i].draw(context, image);}};return ParticlePool;
})();/** Putting it all together*/
(function(canvas) {var context = canvas.getContext('2d'),particles = new ParticlePool(settings.particles.length),particleRate = settings.particles.length / settings.particles.duration, // particles/sectime;// get point on heart with -PI <= t <= PIfunction pointOnHeart(t) {return new Point(160 * Math.pow(Math.sin(t), 3),130 * Math.cos(t) - 50 * Math.cos(2 * t) - 20 * Math.cos(3 * t) - 10 * Math.cos(4 * t) + 25);}// creating the particle image using a dummy canvasvar image = (function() {var canvas  = document.createElement('canvas'),context = canvas.getContext('2d');canvas.width  = settings.particles.size;canvas.height = settings.particles.size;// helper function to create the pathfunction to(t) {var point = pointOnHeart(t);point.x = settings.particles.size / 2 + point.x * settings.particles.size / 350;point.y = settings.particles.size / 2 - point.y * settings.particles.size / 350;return point;}// create the pathcontext.beginPath();var t = -Math.PI;var point = to(t);context.moveTo(point.x, point.y);while (t < Math.PI) {t += 0.01; // baby steps!point = to(t);context.lineTo(point.x, point.y);}context.closePath();// create the fillcontext.fillStyle = '#ea80b0';context.fill();// create the imagevar image = new Image();image.src = canvas.toDataURL();return image;})();// render that thing!function render() {// next animation framerequestAnimationFrame(render);// update timevar newTime   = new Date().getTime() / 1000,deltaTime = newTime - (time || newTime);time = newTime;// clear canvascontext.clearRect(0, 0, canvas.width, canvas.height);// create new particlesvar amount = particleRate * deltaTime;for (var i = 0; i < amount; i++) {var pos = pointOnHeart(Math.PI - 2 * Math.PI * Math.random());var dir = pos.clone().length(settings.particles.velocity);particles.add(canvas.width / 2 + pos.x, canvas.height / 2 - pos.y, dir.x, -dir.y);}// update and draw particlesparticles.update(deltaTime);particles.draw(context, image);}// handle (re-)sizing of the canvasfunction onResize() {canvas.width  = canvas.clientWidth;canvas.height = canvas.clientHeight;}window.onresize = onResize;// delay rendering bootstrapsetTimeout(function() {onResize();render();}, 10);
})(document.getElementById('pinkboard'));</script></BODY>
</HTML>

http://chatgpt.dhexx.cn/article/pNv9ohW7.shtml

相关文章

爱心特效代码

创建一个空文件夹 随意个地方创建空文件夹都会吧 在新创建的文件夹里创建个记事本 右键创建文本文档都会吧 代码全部复制到新建的文本文档里 切记保存 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE…

HTML3D立体城市特效代码

HTML3D立体城市特效代码 鼠标可以控制“行走”方向&#xff0c;立体性很强 index.html代码如下 <!doctype html> <html> <head> <meta charset"utf-8"> <title>3D城市</title><style> html {overflow: hidden;touch-act…

HTML-特效代码大全

HTML特效代码大全&#xff08;一部分## 标题&#xff09; HTML特效代码 1。忽视右键   <body οncοntextmenu“return false”>   或   2。加入背景音乐   IE:   NS:     .mid你的背景音乐的midi格式文件 3。简单的window.open方法   <a href"#"…

html语言闪烁特效代码,css3 文字闪烁特效代码

今天给大家分享几个文字闪烁特效代码,纯css3代码实现,对于新手小伙伴值得拿来学习一下。 文字闪烁特效一 通过改变透明度来实现文字的渐变闪烁,代码如下: 文字闪烁:闪烁效果 .main{color: #666;margin-top: 50px; } /* 定义keyframe动画,命名为blink */ @keyframes blink…

html canvas 烟花 特效代码

代码如下&#xff1a; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><title> 真实烟花</title><style>body {padding: 0;}canvas {display: block;}</style> </head><body>…

html星空代码在线,怎么操作html星空特效代码

html不是一种编程语言&#xff0c;而是一种标记语言 &#xff0c;是网页制作所必备的。这些代码式的专业语言我们在普通的工作中运用的非常少&#xff0c;它的通用性可以把存放在一台电脑中的文本或图形与存放在另一台电脑中的文本或图形方便地联系在一起&#xff0c;形成有机的…

HTML龙卷风特效代码

今天&#xff0c;我给大家带来了短视频平台上超火的HTML龙卷风特效代码&#xff0c;如下&#xff1a; <!DOCTYPE html> <html> <head> <meta charset"utf-8"> <title>粒子漩涡特效</title> <style> html,body{ margin:0px…

html爱心特效代码教程

一、图片展示 二、使用教程 1.桌面新建文本文档 2.将以下代码放入 3.将后缀改为.html 三、代码 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME&…

html爱心特效代码

New Document /* * RequestAnimationFrame polyfill by Erik Mller */ (function(){var b0;var c[“ms”,“moz”,“webkit”,“o”];for(var a0;a<c.length&&!window.requestAnimationFrame;a){window.requestAnimationFramewindow[c[a]“RequestAnimationFrame”…

html简单特效代码,html特效代码大全

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 23. 永远都会带着框架 if (window top)top.location.href "frames.htm"; //frames.htm为框架网页 // --> 24. 防止被人frame if (top.location ! self.location)top.locationself.location; // --> 25. 网页将不…

Android 科大讯飞 语音听写

这几天在搞一个语音识别的项目 用到i的是科大讯飞的语音服务&#xff0c;第一次搞语音识别&#xff0c;在这里记录一下&#xff0c;也希望对大家有用。废话不多说进入正题 一、要用到科大讯飞的语音识别功能&#xff0c;肯定是要他的开发者平台申请账号&#xff0c;创建应用&a…

Python调用科大讯飞语音听写的SDK包

一、如何下载科大讯飞语音听写的SDK包 1.1、注册下载语音听写SDK包 **第一步&#xff1a;**登录讯飞开放平台&#xff0c;找到产品服务——“语音听写”&#xff0c;点击“立即开通” **第二步&#xff1a;**创建新应用 **第三步&#xff1a;**创建应用&#xff0c;填写信息…

C# 实现语音听写

本文系原创&#xff0c;禁止转载。 分享如何使用c#对接科大讯飞语音听写服务&#xff0c;简单高效地实现语音听写。 实现语音听写主要分为录音和语音识别两部分&#xff1b;录音是指获取设备声卡端口的音频数据并将之保存为音频文件&#xff0c;语音识别就是将刚才所述的音频文…

讯飞语音听写

第一步&#xff1a;将下载好的Sdk解压&#xff0c;将压缩文件中的libs下的jar文件放到项目中的libs包下&#xff0c;将压缩文件中的lisb下除jar文件放到main下的jniLibs包中 第二步&#xff1a;Sdk初始化,建议选择在自定义的application中初始化。 //初始化讯飞语音SpeechUtil…

讯飞语音——带你简单实现语音听写

语音听写 de 简单实现 一、前言 如果你没有在讯飞语音平台上创建应用&#xff0c;请先参考讯飞语音的详细配置使用 二、功能描述 语音听写和语音合成都是较为基础也是最常使用的两个基本功能。 语音合成是将文本转化为语音说出来&#xff0c;就是读文章。 语音听写是什么呢&a…

使用讯飞实现语音听写与语音合成功能

一、准备工作 1、首先你需要去科大讯飞的官网去注册一个账号&#xff0c;怎么注册我就不说了&#xff0c;然后去控制台&#xff0c;创建新应用。 2、下载对应的sdk&#xff0c;点击sdk下载&#xff0c;记住这里的APPID码&#xff0c;sdk初始化要用。 3、下载语音听写和在线语…

科大讯飞语音听写在vue2中的使用

安装 worker-loader版本是2.0.0 vue.config.js的配置如下chainWebpack:(config)=>{config.output.globalObject("this"); }, configureWebpack: (config) => {config.module.rules.push({test: /\.worker.js$/,use: {loader: "worker-loader",option…

vue+科大讯飞语音听写功能(解决针对vue new Worker报错问题)

参考1&#xff1a;vue科大讯飞语音听写功能(解决针对vue new Worker报错问题)_Other world的博客-CSDN博客 参考2&#xff1a;vue中使用web worker - Gerryli - 博客园 参考3&#xff1a;将PC浏览器、ZOOM等软件正在播放的音频实时转成文字&#xff01;讯飞语音输入法的妙用 -…

Unity2021接入讯飞语音听写(Android)

使用的引擎工具&#xff1a; Unity2021.3.19 android-studio-2021.1.21 第一步&#xff1a; 新建一个Android项目&#xff08;工程名字随便啦&#xff09; 然后新建一个library &#xff08;同上&#xff0c;库名自己命名吧&#xff09; Android环境目前就算是初步建立好了。 …

vue2中接入讯飞语音听写

首先先登录https://www.xfyun.cn/&#xff0c;在控制台中创建自己的app&#xff0c;并且拿到APPID。 下载crypto-js 与线程worker npm install crypto-js npm install worker-loader 官网中有示例文件&#xff0c;稍微改造一下&#xff0c;封装成组件就能使用了。 transco…