2d-rotate 中文文档教程

发布于 3年前 浏览 28 项目主页 更新于 3年前

2d-rotate

Fast and easy bi-directional 2D matrices rotation tool

功能安装用法

Features

  • Node.JS and browser support
  • Fast, easy and lightweight (0 dependency)
  • Bi-directional rotation (clockwise, counter-clockwise)
  • Working for both square and non-square matrices
  • StandardJS

Installation

# Using Yarn
yarn add 2d-rotate

# Using NPM
npm i 2d-rotate

Usage

import { rotate2d, RotationDirection } from 'rotate-2d'
// const { rotate2d, RotationDirection } = require('rotate-2d')

// Clockwise
rotate2d([
  [1, 2, 3], // [7, 4, 1],
  [4, 5, 6], // [8, 5, 2],
  [7, 8, 9]  // [9, 6, 3]
], RotationDirection.CLOCKWISE) /* Optional, clockwise by default */

// Counter-clockwise
rotate2d([
  [1, 2, 3], // [3, 6, 9],
  [4, 5, 6], // [2, 5, 8],
  [7, 8, 9]  // [1, 4, 7]
], RotationDirection.COUNTER_CLOCKWISE)

2d-rotate

Fast and easy bi-directional 2D matrices rotation tool

FeaturesInstallationUsage

Features

  • Node.JS and browser support
  • Fast, easy and lightweight (0 dependency)
  • Bi-directional rotation (clockwise, counter-clockwise)
  • Working for both square and non-square matrices
  • StandardJS

Installation

# Using Yarn
yarn add 2d-rotate

# Using NPM
npm i 2d-rotate

Usage

import { rotate2d, RotationDirection } from 'rotate-2d'
// const { rotate2d, RotationDirection } = require('rotate-2d')

// Clockwise
rotate2d([
  [1, 2, 3], // [7, 4, 1],
  [4, 5, 6], // [8, 5, 2],
  [7, 8, 9]  // [9, 6, 3]
], RotationDirection.CLOCKWISE) /* Optional, clockwise by default */

// Counter-clockwise
rotate2d([
  [1, 2, 3], // [3, 6, 9],
  [4, 5, 6], // [2, 5, 8],
  [7, 8, 9]  // [1, 4, 7]
], RotationDirection.COUNTER_CLOCKWISE)
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文