Giter VIP home page Giter VIP logo

click-colorful's Introduction

click-colorful 点击特效,五颜六色的小球绽放

click-colorful

demo地址 https://coldday.github.io/click-colorful/

实现见掘金https://juejin.im/post/5be3817de51d457844614b42

背景: 一般这种动画会用canvas实现,但是canvas不是万能的,如果首页加载需要这个动画,页面加载会有大量的请求,这时会阻塞js,造成卡顿 本插件秉着页面加载时尽可能减少js执行原则,采用CSS3结合js,利用硬件加速,提升性能,解决卡顿 默认配置

var params = {
        colors: ["#eb125f", "#6eff8a", "#6386ff", "#f9f383"], // 自定义颜色
        size: 30, // 小球大小
	maxCount: 50, // 点击一次出现多少个球
  }

使用方式

  • 引入click-colorful.js <script src="click-colorful.js"></script>
  • 实力化插件
//params不传,则走默认配置
var color = new colorBall(params)
// 绽放一次
color.fly(x, y)
// 绽放5次,间隔300ms
color.fly(x, y, 5, 300)

click-colorful's People

Contributors

coldday avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.