阅读 1877
一个大小约 2k 的图片高斯模糊库 —— blurify.js

一个大小约 2k 的图片高斯模糊库 —— blurify.js

dependencies devDependencies

Installation

$ npm i blurify复制代码

Demo

Demo

Usage

blurify(options)

blurify the images with given options:

  • images { Element }, blurify target elements.
  • blur { Int }, extent of blur, defaulting to 6.
  • mode { String }, mode of blurify.
    • css: use filter property.(default)
    • canvas: use canvas export base64.
    • auto: use css mode firstly, otherwise switch to canvas mode by automatically.
import blurify from 'blurify';

new blurify({
    images: document.querySelectorAll('.blurify'),
    blur: 6,
    mode: 'css',
});复制代码

本文对你有帮助?欢迎扫码加入前端学习小组微信群:

文章分类
前端
文章标签