当前位置: 首页 > news >正文

Vue3实战笔记(38)—粒子特效终章

文章目录

  • 前言
  • 一、怎样使用官方提供的特效
  • 二、海葵特效
  • 总结


前言

官方还有很多漂亮的特效,但是vue3只有一个demo,例如我前面实现的两个页面就耗费了一些时间,今天记录一下tsparticles官方内置的几个特效的使用方法,一般这几个就足够用了。


一、怎样使用官方提供的特效

例如想使用preset-stars,先安装

pnpm i @tsparticles/preset-stars

新建页面preset-star.vue


<template><div><vue-particles id="tsparticles"  :options="particlesOptions" /></div>
</template><script setup lang="ts" name="">const particlesOptions = {particles: {shape: {type: "star", // starting from v2, this require the square shape script},},preset: "stars",}
</script><style lang='scss' scoped>
</style>

main.ts中:


import { loadStarsPreset } from "@tsparticles/preset-stars";//使用Particles
app.use(Particles, {init: async engine => {await loadFull(engine); // you can load the full tsParticles library from "tsparticles" if you need itawait loadSlim(engine); // or you can load the slim version from "@tsparticles/slim" if don't need Shapes or Animationsawait loadStarsPreset(engine); },})

看看,简简单单就来效果了:
在这里插入图片描述

二、海葵特效

pnpm i @tsparticles/preset-sea-anemone

tsParticles.load({id: "tsparticles",options: {particles: {shape: {type: "square", // starting from v2, this require the square shape script},},preset: "seaAnemone",},
});

在这里插入图片描述
就举这两个例子介绍一下使用方法吧,想要其他特效可以去官网翻翻,还有说明一点这些都是动画特效,运行起来比我截图漂亮多了。


总结

世间万物皆为我所用,非我所属。

http://www.lryc.cn/news/351028.html

相关文章:

  • 晶体振荡器
  • 单词可交互的弧形文本
  • Linux——进程信号(一)
  • centos9 stream在线安装NVIDIA驱动(rockylinux9.4也成功安装nvidia驱动)
  • springmvc不同格式的参数解析
  • Unity3D让BoxCollider根据子物体生成自适应大小
  • WSL 2 installation is incomplete.
  • Servlet的request对象
  • 蓝桥杯-合并数列
  • 《web应用技术》第9次课后作业
  • FRAUDARCatchSync算法简介
  • 刷题之将有序数组转换成二叉搜索树(leetcode)
  • K-means聚类模型教程(个人总结版)
  • android怎么告诉系统不要回收
  • 【FAQ】HarmonyOS SDK 闭源开放能力 —IAP Kit(2)
  • ubuntu设置root开机登录,允许root用户ssh远程登录
  • Web测试面试题(二)
  • VBA宏指令写的方法突然不能用了
  • 第13章 Python建模库介绍
  • IP学习——ospf1
  • 别说废话!说话说到点上,项目高效沟通的底层逻辑揭秘
  • 前后端编程语言和运行环境的理解
  • 一顿五元钱的午餐
  • 【前端每日基础】day60——TDK三大标签及SEO引擎优化
  • vscode添加代办相关插件,提高开发效率
  • JS对象超细
  • 远程PLC、工控设备异地调试,贝锐蒲公英异地组网方案简单高效
  • 【算法】梦破碎之地---三数之和
  • c语言如何将一个文本内容复制到另外一个文本里
  • JavaScript基础(九)