Propeller

用于使用鼠标或触摸手势旋转元素的JavaScript库。 支持惯性和逐步旋转。 优化以获得更好的性能。(JavaScript library to rotate elements with mouse or touch gestures. Supports inertia and stepwise rotation. Optimized for better performance.)

  • 所有者: PixelsCommander/Propeller
  • 平台: Android, iOS, Web browsers
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Propeller.js

JavaScript library to rotate elements by mouse. Supports inertia and stepwise rotation. It is also compatible with touch devices.

Lot of demos

Spinner game drawn by my doughter

Project page

Propeller.js

Usage

Available on NPM

npm install Propeller

Easy-to-use as jQuery plugin:

$(nodeOrSelector).propeller(options);

or zero-dependancy library

new Propeller(nodeOrSelector, options)

Performance

Propeller uses requestAnimationFrame and GPU compositing for better performance.

Options

  • angle sets initial angle
  • inertia is the most valueble option. It is a number between 0 and 1. 0 means no rotation after mouse was released. 1 means infinite rotation. For this demo we use inertia equals to 0.99.
  • speed - initial speed of rotation. It also can be used as property in runtime.
  • minimalSpeed - minimal speed of rotation. Works only if propeller have inertia between 0 and 1.
  • step allows to set step in degrees for stepwise mode.
  • stepTransitionTime enables CSS transition to move from step to step. This makes steps smooth and allows to use CSS transitions easing.
  • stepTransitionEasing CSS easing mode for transition when in stepwise mode and stepTransitionTime is more than zero. A bit more about easing functions
  • onRotate callback executed when rotated. You can easily get current angle as this.angle inside of callback function.
  • onStop callback executed when stopped.
  • onDragStart callback executed when start dragging.
  • onDragStop callback executed when stop dragging.

Methods

  • unbind unbind listeners to make propeller inactive, this does not stop rotation
  • bind bind listeners after they were unbinded
  • stop stop rotation immidiately

Public properties

  • angle current propellers angle.
  • speed current speed of rotation. Degrees per frame.

License

MIT: http://mit-license.org/

Copyright 2014 Denis Radin aka PixelsCommander

主要指標

概覽
名稱與所有者PixelsCommander/Propeller
主編程語言JavaScript
編程語言JavaScript (語言數: 3)
平台Android, iOS, Web browsers
許可證
所有者活动
創建於2014-01-12 23:18:52
推送於2018-02-24 17:12:36
最后一次提交2018-02-24 18:12:35
發布數0
用户参与
星數413
關注者數18
派生數56
提交數51
已啟用問題?
問題數33
打開的問題數12
拉請求數7
打開的拉請求數1
關閉的拉請求數1
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?