npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

face-effet

v1.5.5

Published

effet.js 是一个轻量级的人脸样式框架,专注于为网页带来生动的面部动画效果。通过简单的API,开发者可以轻松实现眨眼、张嘴、摇头等动态表情,使用户界面更加互动和生动。effet.js 适用于需要增强用户体验的各种应用场景,特别是在前端项目中集成复杂的人脸动态效果。

Readme

Effet.js

Effet.js 是一个轻量级的 JavaScript 框架,专为前端开发提供人脸检测、登录、打卡等功能。它具有易于使用的 API,可以快速集成人脸识别到你的 Web 应用中。

安装

你可以通过 npm 安装 Effet.js,也可以直接通过 CDN 引入。

使用 npm 安装

首先,在项目根目录下运行以下命令安装 Effet.js

npm i face-effet

使用 CDN 引入

如果你不想通过 npm 安装,可以使用以下方式通过 CDN 直接引入 Effet.js

<script src="https://unpkg.com/face-effet/effet/effet.js"></script>

项目结构

├── effet
│   ├── src
│   │   ├── components
│   │   │   ├── enums
│   │   │   │   └── Constant.ts -------公共的枚举
│   │   │   ├── AppState.ts -----------内部初始化数据
│   │   │   └── FaceManager.ts --------管理当前dom单例,用于消息替换
│   │   ├── core
│   │   │   ├── action ----------------动作函数,处理各种动作,例如人脸添加、登录、睡眠检测、打卡
│   │   │   │   ├── addFace
│   │   │   │   │   └── index.js ------处理人脸添加的主要逻辑
│   │   │   │   ├── checkLogin
│   │   │   │   │   └── index.js ------处理登录检测的逻辑
│   │   │   │   ├── checkSleep
│   │   │   │   │   └── index.js ------处理睡眠检测的逻辑
│   │   │   │   ├── clockIn
│   │   │   │   │   └── index.js ------处理打卡的主要逻辑
│   │   │   │   └── faceAction.js - 动作函数入口
│   │   │   ├── before ----------------动作前的预处理逻辑
│   │   │   │   ├── checkLogin
│   │   │   │   │   └── index.js ------登录前置函数操作
│   │   │   │   └── faceBefore.js -预处理入口
│   │   │   ├── db --------------------数据库相关逻辑
│   │   │   │   └── db.js
│   │   │   ├── defaultAssign ---------默认配置和参数分配
│   │   │   │   └── assign.js
│   │   │   ├── dom -------------------DOM 操作相关逻辑
│   │   │   │   ├── createFaceElements.js -创建人脸相关的 DOM 元素
│   │   │   │   └── defaultElement.js ---默认元素配置
│   │   │   ├── log ---------屏蔽插件相关内警告
│   │   │   │   └── log.js
│   │   │   └── index.js --------------核心模块的入口文件
│   │   ├── styles --------------------样式文件
│   │   │   ├── template
│   │   │   │   ├── addFace -----------人脸添加的样式模板
│   │   │   │   │   ├── index.css -----添加人脸的样式文件
│   │   │   │   │   └── index.js ------添加人脸的逻辑
│   │   │   │   └── checkLogin --------登录检测的样式模板
│   │   │   │       ├── index.css -----登录检测的样式文件
│   │   │   │       └── index.js ------登录检测的逻辑
│   │   │   ├── faceColor.js ----------与人脸样式颜色相关的逻辑
│   │   │   └── root.css --------------全局样式
│   │   ├── util ----------------------通用工具函数
│   │   │    ├── cameraAccessUtils.js --处理摄像头访问的工具
│   │   │    ├── cameraUtils.js --------摄像头操作的通用工具
│   │   │    ├── checkIfMeetsUtils.js --检查条件满足的工具
│   │   │    ├── deviceUtil.js ---------设备相关的工具函数
│   │   │    ├── distanceUtils.js ------距离计算工具
│   │   │    ├── drawingUtils.js -------绘制相关的工具函数
│   │   │    ├── faceMesh.js -----------人脸网格处理相关逻辑
│   │   │    ├── getImageReturnUtils.js -处理图像返回的工具
│   │   │    ├── getKey.js -------------获取键值的工具函数
│   │   │    ├── imageUtils.js ---------图像处理相关工具
│   │   │    └── isEmptyFunctionUtil.js -检查空函数的工具
│   │   └── index.js ----------------------程序的主要入口 

动作新增

如果我们需要新增一个新的动作

(1)Constant.ts 首先在当前枚举的 FACE_TYPE 新增一个类别,如:'faceNew'

(2)在 action 文件夹,创建一个 'faceNew' 的文件夹,然后在当前文件夹创建index.js

(3)创建完成后,基本入口都是一样的,具体参考其他的人脸动作,如下:

export default (appData,results,currentObj,callBackResult,stopRecording,startRecording) => {
    // 在这里写你具体动作算法
};

(4)使用方式

<div id="myface"></div>

<script>
    effet.init({
        el: 'myface',
        type:'faceNew',
        callBack: (data) => {
            console.log(data);
        }
    });
</script>

(5)默认值设置,可在 assign.js 设置你的默认值,具体参考其他值的设置方式

(6)样式编辑,基于 appearance 参数,判断当前是否有样式,在 assign.js 人脸打卡跟睡眠检测被强制为 false, 如果你当前新增的这个类别也没有样式,应该跟其他两个模式一样,强制为false,如果需要样式,则需要在 styles/template文件夹下面新增一个文件夹叫 faceNew 然后在这个文件夹创建index.css 跟index.js 然后写具体的操作

项目依赖

以下是项目中使用到的主要依赖及其版本信息:

  • Babel Core @babel/core: ^7.25.2
  • Babel Preset Env @babel/preset-env: ^7.25.3
  • Babel Loader babel-loader: ^9.1.3
  • CSS Loader css-loader: ^7.1.2
  • CSS Minimizer Webpack Plugin css-minimizer-webpack-plugin: ^7.0.0
  • File Loader file-loader: ^6.2.0
  • Mini CSS Extract Plugin mini-css-extract-plugin: ^2.9.1
  • PostCSS postcss: ^8.4.41
  • PostCSS Loader postcss-loader: ^8.1.1
  • Style Loader style-loader: ^4.0.0
  • TS Loader ts-loader: ^9.5.1
  • TypeScript typescript: ^5.5.4
  • Webpack webpack: ^5.0.0
  • Webpack CLI webpack-cli: ^4.0.0

特别注意,本项目中使用到了 facemesh.js,请确保使用的是最新版本以获取最新的功能和改进。

使用方式

具体使用和 API 文档请查看 官方网站,以获取详细信息和更多示例。

许可证

本项目采用 MIT 许可证,详细信息请查看 LICENSE 文件。