@any-touch/swipe

April 2, 2022 · View on GitHub

快划识别器.

安装

npm i -S @any-touch/swipe

快速开始

// 只加载rotate识别器(旋转)
import Core from '@any-touch/core';
import swipe from '@any-touch/swipe';
const at = new Core(el);
at.use(swipe, 参数)

// 旋转
at.on('swipe', (event) => {
    // event包含位置/速度/方向等信息
});

参数

名称数据类型默认值说明
nameString'swipe'自定义事件名称
pointLengthNumber1支持的触点数, 可支持多指触发
thresholdNumber10触点离开前, 按压移动的距离超过10px才能触发事件
velocityNumber0.3快划超过30px/ms才触发事件