• Stars
    star
    2,968
  • Rank 15,256 (Top 0.4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Smooth scrolling, rotation, pull to refresh, page transition and any motion for the web - 丝般顺滑的触摸运动方案

PhyTouch

丝般顺滑的触摸运动方案

Smooth scrolling, rotation, pull to refresh and any motion for the web.

Install

npm install phy-touch

Usage

var phyTouch = new PhyTouch({
  touch:"#wrapper",//反馈触摸的dom
  vertical: true,//不必需,默认是true代表监听竖直方向touch
  target: { y: 0 }, //运动的对象
  property: "y",  //被运动的属性
  min: 100, //不必需,运动属性的最小值
  max: 2000, //不必需,滚动属性的最大值
  sensitivity: 1,//不必需,触摸区域的灵敏度,默认值为1,可以为负数
  factor: 1,//不必需,表示触摸位移运动位移与被运动属性映射关系,默认值是1
  moveFactor: 1,//不必需,表示touchmove位移与被运动属性映射关系,默认值是1
  step: 45,//用于校正到step的整数倍
  bindSelf: false,
  maxSpeed: 2, //不必需,触摸反馈的最大速度限制 
  value: 0,
  change:function(value){ 
    target.style.transform = "translate(0," + value + "px)"
    target.style.webkitTransform = "translate(0," + value + "px)"
  }, 
  touchStart:function(evt, value){  },
  touchMove:function(evt, value){  },
  touchEnd:function(evt,value){  },
  tap:function(evt, value){  },
  pressMove:function(evt, value){  },
  animationEnd:function(value){  } //运动结束
})

通过对象的实例可以自行运动DOM:

phyTouch.to(value, time, ease)
  • value是必填项
  • time是非必填项,默认值是600
  • ease是非必填项,默认值是先加速后减速的运动函数,CSS版本默认值是cubic-bezier(0.1, 0.57, 0.1, 1)

通过对象的实例可以自行停止DOM运动:

phyTouch.stop()

Demo(Mobile)

Related links

License

This content is released under the MIT License.

More Repositories

1

Mars

腾讯移动 Web 前端知识库
9,612
star
2

AlloyFinger

Super tiny size multi-touch gestures library for the web.    You can touch this →
JavaScript
3,418
star
3

AlloyImage

基于HTML5的专业级图像处理开源引擎。An image processing lib based on html5.
JavaScript
3,018
star
4

eslint-config-alloy

Progressive ESLint config for your React/Vue/TypeScript projects
JavaScript
2,641
star
5

AlloyLever

1kb js library contains development debugging, error monitoring and reporting, user problem localization features - 1KB代码搞定开发调试发布,错误监控上报,用户问题定位
JavaScript
1,382
star
6

curvejs

Made curve a dancer in HTML5 canvas - 魔幻线条
JavaScript
1,303
star
7

CodeGuide

Alloyteam代码规范
HTML
1,279
star
8

JX

JX(Javascript eXtension tools) 是腾讯AlloyTeam推出的模块化、非侵入式Web前端框架,适合构建和组织工业级大规模、高效率的 Web App
JavaScript
1,153
star
9

AlloyCrop

The best and tiny size mobile cropping component - 做最好且最小的移动裁剪组件
JavaScript
941
star
10

Rythem

a fiddler-like project using Qt
C++
888
star
11

alloyteam.github.com

腾讯 AlloyTeam 开源项目官网 - 我们的愿景: 成为业界卓越的Web团队!
JavaScript
849
star
12

alloy-worker

面向事务的高可用 Web Worker 通信框架
TypeScript
644
star
13

AlloyStick

AlloyStick 骨骼动画引擎 - 腾讯 AlloyTeam
JavaScript
437
star
14

Rosin

A tool for web developers debug mobile page with fiddler. http://alloyteam.github.io/Rosin/
C#
312
star
15

StreetFighter

街霸StreetFighter
JavaScript
305
star
16

webtop

HTML5 本地App开发引擎
C++
290
star
17

AlloyPhoto

JavaScript
277
star
18

gopng

GoPng - a HTML5 css sprite generator with cool feature.
273
star
19

sodajs

Light weight but powerful template engine for JavaScript
JavaScript
257
star
20

tslint-config-alloy

AlloyTeam TSLint 规则
JavaScript
205
star
21

JXAnimate

基于CSS3的并行动画、声音引擎 - JX.Animate
CSS
195
star
22

AlloyTimer

AlloyTimer定时器 - 番茄工作法的时间管理应用
JavaScript
195
star
23

JMUI

移动Web开发UI组件库
JavaScript
178
star
24

AlloyViewer

H5图片查看器—Imageview component built with react
JavaScript
176
star
25

JM

面向Mobile的极致JavaScript库
JavaScript
141
star
26

AlloyDesigner

AlloyDesigner是一款致力于提高前端生产效率的浏览器内运行工具,AlloyDesigner + Chrome F12(Especially with WorkSpace) 打造前端新的开发和测试模式
138
star
27

omi-cli

Create website with no build configuration - 创建网站无需任何配置
JavaScript
125
star
28

AlloyPullRefresh

JavaScript
119
star
29

Spirit

腾讯移动Web整体解决方案
CSS
117
star
30

CodeTank

CodeTank(代码坦克)是全世界首款 Javascript 程序员的游戏, 由腾讯 AlloyTeam 用 HTML5、Javascript 等 Web 新技术来构建一个基于互联网的智能坦克机器人战斗仿真引擎
114
star
31

AlloyClip

A PC & Mobile Image Clip Kit based on AlloyImage
JavaScript
108
star
32

MLogger

一个浮在页面上的日志查看工具
JavaScript
100
star
33

Abstract.js

Abstract.js is a web framework for fast development
JavaScript
46
star
34

AlloyLint

apply eslint autofix but keep last author info in git blame。运行 eslint 的自动修复,但是保留最后修改人的信息
TypeScript
41
star
35

AlloyFlow

made workflow simple
JavaScript
38
star
36

AlloyTicker

The Master of Time          DEMO
JavaScript
25
star
37

netural

JavaScript前向神经网络(推理)和反向传播(训练)的实现
JavaScript
22
star