Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swiperia-core

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swiperia-core

Swiperia Core: The foundational engine for handling swipe gestures in JavaScript. Provides platform-agnostic utilities to detect swipe direction, calculate distance and velocity, and analyze swipe movement data.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Swiperia Core

Swiperia Core is the foundation of the Swiperia library, providing essential utilities and functions for handling swipe gestures and calculating swipe-related metrics. This package is designed to be platform-agnostic and can be used in any JavaScript environment, including the browser, Node.js, and React Native.

Features

  • Swipe Direction Detection: Determine the direction of a swipe gesture (left, right, up, down) based on the start and end coordinates.
  • Swipe Distance Calculation: Calculate the distance traveled during a swipe gesture.
  • Swipe Velocity Calculation: Calculate the velocity of a swipe gesture, including the separate velocities along the x and y axes.
  • Swipe Movement Analysis: Analyze the movement of a swipe gesture, including the start and end coordinates, delta values, and absolute delta values.
  • Swipe Event Handling: Provide a consistent and extensible way to handle swipe events, such as start, move, end, and cancel.

Installation

You can install the swiperia-core package using npm or yarn:

npm install swiperia-core
# or
yarn add swiperia-core

Usage

Here's a basic example of how to use the swiperia-core package:

import { direction, distance, movement, velocity, vxvy } from 'swiperia-core';

const start = [100, 200];
const end = [300, 250];
const duration = 500; // in milliseconds

const swipeData = movement(start, end, duration);

console.log('Swipe Direction:', direction(start, end)); // Output: 'right'
console.log('Swipe Distance:', distance(start, end)); // Output: 208.06...
console.log('Swipe Velocity:', velocity(start, end, duration)); // Output: 416.12...
console.log('Swipe Velocity (x, y):', vxvy(start, end, duration)); // Output: [400, 100]
console.log('Swipe Movement:', swipeData);

Documentation

For detailed documentation, including API references and advanced usage examples, please visit the Swiperia Documentation.

Contributing

We welcome contributions from the community! If you'd like to contribute to Swiperia Core, please read our Contributing Guide for more information.

License

Swiperia Core is released under the MIT License.

Keywords

FAQs

Package last updated on 10 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc