Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AlloyTeam/PhyTouch
Smooth scrolling, rotation, pull to refresh, page transition and any motion for the web - 丝般顺滑的触摸运动方案
https://github.com/AlloyTeam/PhyTouch
css3transform motion scroll scrolling touch transform transformations transformjs
Last synced: about 1 month ago
JSON representation
Smooth scrolling, rotation, pull to refresh, page transition and any motion for the web - 丝般顺滑的触摸运动方案
- Host: GitHub
- URL: https://github.com/AlloyTeam/PhyTouch
- Owner: AlloyTeam
- License: mit
- Created: 2015-10-12T11:04:43.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:01:47.000Z (almost 2 years ago)
- Last Synced: 2024-10-29T12:57:43.341Z (about 2 months ago)
- Topics: css3transform, motion, scroll, scrolling, touch, transform, transformations, transformjs
- Language: JavaScript
- Homepage: http://alloyteam.github.io/PhyTouch/
- Size: 3.84 MB
- Stars: 2,968
- Watchers: 160
- Forks: 525
- Open Issues: 84
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## PhyTouch
丝般顺滑的触摸运动方案
Smooth scrolling, rotation, pull to refresh and any motion for the web.
## Install
```js
npm install phy-touch
```* [https://unpkg.com/[email protected]/index.js](https://unpkg.com/[email protected]/index.js)
## Usage
```js
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:
``` js
phyTouch.to(value, time, ease)
```* `value`是必填项
* `time`是非必填项,默认值是600
* `ease`是非必填项,默认值是先加速后减速的运动函数,CSS版本默认值是`cubic-bezier(0.1, 0.57, 0.1, 1)`通过对象的实例可以自行停止DOM运动:
``` js
phyTouch.stop()
```## Demo(Mobile)
- Pull To Refresh: [http://alloyteam.github.io/PhyTouch/refresh/pull_refresh/](http://alloyteam.github.io/PhyTouch/refresh/pull_refresh/)
- QQ KanDian: [http://alloyteam.github.io/PhyTouch//refresh/infinite/kandian.html](http://alloyteam.github.io/PhyTouch//refresh/infinite/kandian.html)
- Full Page Scroll : [http://alloyteam.github.io/PhyTouch/full_page/](http://alloyteam.github.io/PhyTouch/full_page/)
- Simple : [http://alloyteam.github.io/PhyTouch/example/simple.html](http://alloyteam.github.io/PhyTouch/example/simple.html)
- 3D : [http://alloyteam.github.io/PhyTouch/example/3d.html](http://alloyteam.github.io/PhyTouch/example/3d.html)
- Rotate : [http://alloyteam.github.io/PhyTouch/example/rotate.html](http://alloyteam.github.io/PhyTouch/example/rotate.html)
- Carousel : [http://alloyteam.github.io/PhyTouch/example/carousel.html](http://alloyteam.github.io/PhyTouch/example/carousel.html)
- Carousel2 : [http://alloyteam.github.io/PhyTouch/example/carousel2.html](http://alloyteam.github.io/PhyTouch/example/carousel2.html)
- Three.js : [http://alloyteam.github.io/PhyTouch/example/threejs/](http://alloyteam.github.io/PhyTouch/example/threejs/)## Related links
* [omi-touch: Omi /PhyTouch integration](https://github.com/Tencent/omi/tree/master/packages/omi-touch)
* [PhyTouch Wiki](https://github.com/AlloyTeam/PhyTouch/wiki)## License
This content is released under the [MIT](http://opensource.org/licenses/MIT) License.