Giter Site home page Giter Site logo

egret_gesture's Introduction

Egret手势识别库

版本:Alpha 0.2

目前处于测试阶段,欢迎使用并提出您宝贵的建议,如发现Bug,请提交Bug详情,或者修复后发送Pull Request合并到主库。

简介

本库旨在为Egret封装常用的手势操作,因本人能力有限,有的实现并不完善,欢迎批评指正。

目前已实现的手势:

  1. Tap(点一下)
  2. Double Tap (双击)
  3. Pinch(二指往內或往外拨动,平时经常用到的缩放)
  4. Rotation(旋转)
  5. Swipe(滑动,快速移动)
  6. Pan (拖移,慢速移动)
  7. LongPress(长按)

演示: Demo

使用方式

使用很简单:

第一步,下载本库,现在已经做成标准的第三方库,下载到本地后,可以用egret build命令对库进行编译。 然后在您的项目的配置文件里,引用一下手势库:

{
    "name":"neoges_lib",
    "path":"../neoges_lib"
}

第二步,选择你想使用的手势,创建手势对象,然后侦听事件即可。事件有4种:

  • BEGAN 手势开始
  • UPDATE Touch点处于变化中
  • ENDED 手势结束
  • FAILED 手势失败

以双击举例,示例代码:

var tap:neoges.DoubleTapGesture = new neoges.DoubleTapGesture(this.sky);
tap.addEventListener(neoges.GestureEvent.ENDED,this.onDoubleTap,this);
private onDoubleTap(event:neoges.GestureEvent):void {
    this.showMsg("double tap on "+event.host.name);
}

所有手势的使用方式,可以从这里找到:MainTest

扩展

扩展手势库也很简单,继承neoges.AbstractGesture并重写相关的方法即可。

egret_gesture's People

Contributors

anewg avatar feirlau avatar neoguo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.