Mobile Web Touch and Motion solutions Alloytouch Open Source

Source: Internet
Author: User

Portal

GitHub Address: Https://github.com/AlloyTeam/AlloyTouch

Brief introduction

The essence of Alloytouch is to move a number that maps the physical changes of a number to any attribute you want to map. So it brings a wide range of application scenarios. No matter the actual application, the game, the operating system and so on many levels, listens to the user to touch, gives the user the real motion feedback is the very common application scene. such as the glory of kings, rotating user role, lottery program scrolling turntable, page scrolling, local scrolling and so on.

The above scenarios will use one of the following three procedures:

    • Touch, motion, deceleration, stop
    • Touch, motion, deceleration, rebound, stop
    • Touch, Bounce, stop

The above movement can be any form, such as rotation, panning, zoom and other motion forms. Of course, in the process above, if there are other user interaction involved, will stop the current process, and then feedback the user new touch gestures. Alloytouch was born to solve this kind of problem. At the same time to do:

    • Minimal file size (less than 300 lines of code)
    • Regardless of page layout
    • Motion attribute independent, can move object Word amount (for example {x:100})
    • Render-independent design (DOM, canvas, WebGL, svg all work)
    • Real physical trajectory of motion
    • High-Performance Motion mode
    • Minimalist API Design
Installation
npm install alloytouch
Use Posture
New Alloytouch ({Touch"#wrapper",Feedback Touch of Dom Target:target,object property of Motion:"Translatey",Properties of the Movement min:100,Not required, the minimum value of the motion attribute, which will bounce max out of bounds:2000,The maximum value of the scrolling property is not required, and the bounds bounce vertical:TrueNot required, the default is true to monitor the vertical direction of touch sensitivity:1,Not required, the sensitivity of the touch area, the default value is 1, can be negative factor:1,Not required, indicates that the touch displacement is mapped to the motion property, and the default value is 1 step:45,//not required, used to correct integer times to step change:function (//not required, property changed callbacks. ALLOYTOUCH.CSS version does not support this event Touchstart:function (value) {}, touchmove: function (value) {}, touchend:function (value) {}, animationEnd:function (value) {} //End of movement})             

For example, above is the Translatey property of the target, it must have the Translatey property in order to work properly.
You can use TRANSFORMJS to give the DOM a fast tranformation capability. So it is generally necessary to Alloytouch DOM elements, you can:

var target = document.querySelector("#scroller");//给element注入transform属性Transform(target,true);new AlloyTouch({......
Function Demo



# #在线Demo

# #开始AlloyTouch吧
GitHub Address: Https://github.com/AlloyTeam/AlloyTouch
Welcome Issues:https://github.com/alloyteam/alloytouch/issues
We will respond to your comments and suggestions in the first time.

Mobile Web Touch and Motion solutions Alloytouch Open Source

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.