# image-verification-rotation

> This is a react component that implements the function of rotating images for verification and used typescript

Latest version **1.5.1** (published 2023-04-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install image-verification-rotation
pnpm add image-verification-rotation
yarn add image-verification-rotation
bun add image-verification-rotation
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2023-04-24 |
| First published | 2023-04-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 23.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | wangxin |
| Maintainers | wangchuaichuai |
| Keywords | captcha, image-captcha, react, typescript, image-rotation-verification, verification-code, verification, rotating, react-component, react-image-captcha, react-image-verification-code, 验证码, 图形验证码, 旋转图片, 旋转 |

## Links

- npm: https://www.npmjs.com/package/image-verification-rotation
- npm.io page: https://npm.io/package/image-verification-rotation

## Dependencies (2)

- [react](https://npm.io/package/react.md) ^18.2.0
- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.5.1 (latest) — 2023-04-24
- 1.5.0 — 2023-04-24
- 1.4.2 — 2023-04-06
- 1.4.1 — 2023-04-06
- 1.3.8 — 2023-04-06
- 1.3.7 — 2023-04-06
- 1.3.6 — 2023-04-06
- 1.3.5 — 2023-04-06
- 1.3.4 — 2023-04-06
- 1.3.3 — 2023-04-06
- 1.3.2 — 2023-04-06
- 1.3.1 — 2023-04-06
- 1.2.1 — 2023-04-06
- 1.1.1 — 2023-04-06

## README

# Welcome to use the rotating image verification code component. This component is written for React

Warehouse address: https://github.com/wangchuaichuai/react-image-verification-rotation

This component uses "clip-path" CSS properties, which may result in incompatibility with lower versions of IE browsers

If the overlay setting for compatible IE browsers is false, do not use this property

Develop the canvas version later on

At the same time, all relevant attributes of div can also be used

Welcome to raise questions for improvement

### Parameter Introduction

```typescript
interface ImageVerificationProps extends HTMLAttributes<HTMLDivElement> {
  src?: string
  offsetAngleTemp?: number
  onSuccess?: Function
  onFailer?: Function
  overlay?: boolean
  imgShow?: boolean
  width?: number
  height?: number
  imgWidth?: number
  deviationAngle?: number
  successText?: string
  failText?: string
  initText?: string
  CustomButton?: React.ReactNode
}
```

- The above are optional parameters

####

1. **src** is the address of the rotated image. If it is not passed in, use the image link I provided
2. **offsetAngleTemp** is the initial angle. You can provide the initial angle yourself or use the built-in random angle without passing in this parameter
3. **onSuccess** is a method that triggers when validation passes
4. **onFailer** is a method that triggers when validation fails
5. **overlay** overlay images to create small traps and large circles
6. **imgShow** is a boolean value that displays the original image when it is true, and not when it is false
7. **width** is the width of the component
8. **height** is the height of the component
9. **imgWidth** is the width and height of the image
10. **deviationAngle** is the deviation value of the verification angle, with a default deviation of 5 degrees
11. **successText** is the copy that has been successfully verified
12. **failText** is the copy that failed validation
13. **initText** is the prompt text
14. **CustomButton** allows you to customize the style of the reset button by defining an element and passing it in

### Use

1. you can use

```typescript
npm install image-verification-rotation
```

or

```typescript
yarn add image-verification-rotation
```

2. This library uses the ES6 module export, so when used

```typescript
import Verification from 'image-verification-rotation'
```

3. There is already a. dts declaration file in the file, so there is no need to import @ types/image verification annotation
4. use

```typescript
<Verification  />
// or
  <App
    style={{ margin: '200px auto' }}
    imgWidth={400}
    height={400}
    width={400}
    overlay={true}
    imgShow={true}
  />
```

### Example

1. imgShow = true
   ![imgShow = true](http://8.142.84.52:5555/public/img/verification-ex/1.png)

```tsx
export default function Example() {
  const Btn: React.FC = () => {
    return <button>sadas</button>
  }
  return (
    <Verification
      style={{ margin: '200px auto' }}
      onSuccess={() => console.log('success')}
      onFailer={() => console.log('failer')}
      offsetAngleTemp={54}
      deviationAngle={10}
      CustomButton={<Btn />}
    />
  )
}
```

2. imgShow = false && overlay = true

![imgShow = false && overlay = true](http://8.142.84.52:5555/public/img/verification-ex/2.png)

```tsx
export default function Example() {
  const Btn: React.FC = () => {
    return <button>sadas</button>
  }
  return (
    <Verification
      style={{ margin: '200px auto' }}
      onSuccess={() => console.log('success')}
      onFailer={() => console.log('failer')}
      offsetAngleTemp={54}
      imgShow={false}
      overlay={true}
      deviationAngle={10}
      CustomButton={<Btn />}
    />
  )
}
```

3. imgShow = true && overlay = true

![imgShow = true && overlay = true](http://8.142.84.52:5555/public/img/verification-ex/3.png)

```tsx
export default function Example() {
  const Btn: React.FC = () => {
    return <button>sadas</button>
  }
  return (
    <Verification
      style={{ margin: '200px auto' }}
      onSuccess={() => console.log('success')}
      onFailer={() => console.log('failer')}
      offsetAngleTemp={54}
      imgShow={true}
      overlay={true}
      deviationAngle={10}
      CustomButton={<Btn />}
    />
  )
}
```

---
_Source: https://npm.io/package/image-verification-rotation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
