Awesome
<h1 align="center" style="max-width: 100%;"> <img width="256" alt="Axes Logo" src="https://raw.githubusercontent.com/naver/egjs-axes/master/packages/demo/static/img/axes.svg" style="max-width: 256px;" /><br/> <a href="https://naver.github.io/egjs-axes/">@egjs/axes</a> </h1> <p align="center" style="line-height: 2;"> <a href="https://www.npmjs.com/package/@egjs/axes" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/axes.svg?style=flat-square&color=007acc&label=version&logo=NPM" alt="version" /></a> <a href="https://www.npmjs.com/package/@egjs/axes" target="_blank"><img alt="npm weekly downloads" src="https://img.shields.io/npm/dw/@egjs/axes?logo=npm&style=flat-square&color=007acc" /></a> <a href="https://www.npmjs.com/package/@egjs/axes" target="_blank"><img alt="npm bundle size (scoped)" src="https://img.shields.io/bundlephobia/minzip/@egjs/axes.svg?style=flat-square&label=%F0%9F%92%BE%20gzipped&color=007acc" /></a> <a href="https://travis-ci.org/naver/egjs-axes" target="_blank"><img alt="Build Status" src="https://api.travis-ci.org/naver/egjs-axes.svg?branch=master" /></a> <a href="https://coveralls.io/github/naver/egjs-axes?branch=master&style=flat-square" target="_blank"><img alt="Coveralls github" src="https://img.shields.io/coveralls/github/naver/egjs-axes.svg?style=flat-square&label=%E2%9C%85%20coverage" /></a> <a href="https://github.com/naver/egjs-axes/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/static/v1?style=flat-square&label=%F0%9F%93%9C%20license&message=MIT&color=08CE5D" /></a> <img src="https://img.shields.io/static/v1.svg?label=&message=TypeScript&color=294E80&style=flat-square&logo=typescript" /> </p> <h3 align="center"> <a href="https://naver.github.io/egjs-axes/">Demo</a> / <a href="https://naver.github.io/egjs-axes/docs/api/Axes">Documentation</a> / <a href="https://naver.github.io/egjs/"><img height="20" src="https://naver.github.io/egjs/img/logo.svg"/> Other components</a> </h3> <p align="center"> <b>You can easily create a UI that responds to user actions.</b><br /> </p><img src="https://github.com/naver/egjs-axes/raw/master/packages/demo/static/img/demos/structure.png" style="width:100%">
✨ Features
- Axes translate user action entered by various input devices into the virtual coordinate system.
- You can create an UI that responds to user actions.
- Provides five input types. These can be associated with a user interface.
- Provides six types of events generated by InputTypes.
- Moreover, you can create your own custom InputTypes!
⚙️ Installation
npm
$ npm install @egjs/axes
CDN
- jsDelivr: https://cdn.jsdelivr.net/npm/@egjs/axes/dist/
- unpkg: https://unpkg.com/@egjs/axes@latest/dist/
- cdnjs: https://cdnjs.com/libraries/egjs-axes
🏃 Quick Start
1. Set up your HTML
<div id="area"></div>
2. Load files or import library
ES5
<script src="https://naver.github.io/egjs-axes/release/latest/axes.pkgd.js"></script>
var Axes = eg.Axes;
var PanInput = Axes.PanInput;
var PinchInput = Axes.PinchInput;
var WheelInput = Axes.WheelInput;
var MoveKeyInput = Axes.MoveKeyInput;
ES6+
import Axes, {PanInput, PinchInput, WheelInput, MoveKeyInput} from "@egjs/axes";
3. Initialize Axes
// create eg.Axes with option
const axes = new Axes({
something1: { range: [0, 100] },
something2: { range: [0, 100] },
somethingN: { range: [-200, 200] }
});
4. Attach event handlers
axes.on({
"change": evt => /* ... */
});
5. Initialize InputTypes to use
const panInput = new PanInput("#area");
const wheelInput = new WheelInput("#wArea");
const pinchInput = new PinchInput("#pArea");
const movekeyInput = new MoveKeyInput("#mArea");
6. Connect eg.Axes and InputTypes
axes.connect(["something2", "somethingN"], panInput);
axes.connect(["something1"], wheelInput);
axes.connect(["something2"], pinchInput);
axes.connect(["something1", "something2"], movekeyInput);
7. Enjoy!
You can change the value of the axis through touch screen, mouse or anything else.
🌐 Supported Browsers
<img width="20" src="https://simpleicons.org/icons/internetexplorer.svg" alt="IE" /> | <img width="20" src="https://simpleicons.org/icons/googlechrome.svg" alt="Chrome" /> | <img width="20" src="https://simpleicons.org/icons/firefoxbrowser.svg" alt="Firefox" /> | <img width="20" src="https://simpleicons.org/icons/safari.svg" alt="Safari" /> | <img width="20" src="https://simpleicons.org/icons/apple.svg" alt="iOS" /> | <img width="20" src="https://simpleicons.org/icons/android.svg" alt="Android" /> |
---|---|---|---|---|---|
10+ | Latest | Latest | Latest | 7+ | 2.3+(except 3.x) |
🔧 Dependency
egjs-axes has the dependencies for the following libraries:
eg.Component | eg.Agent |
---|---|
3.0.1+ | 2.2.1+ |
📼 Demos
Check our Demos.
📖 Documentation
See Documentation page.
🙌 Contributing
See CONTRIBUTING.md.
📝 Feedback & Bug Report
Please file an Issue.
📜 License
@egjs/axes is released under the MIT license.
Copyright (c) 2015 NAVER Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
<p align="center">
<a href="https://naver.github.io/egjs/"><img height="50" src="https://naver.github.io/egjs/img/logotype1_black.svg" /></a> <a href="https://github.com/naver"><img height="50" src="https://naver.github.io/OpenSourceGuide/book/assets/naver_logo.png" /></a>
</p>