Socket
Socket
Sign inDemoInstall

gradient-alpha

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gradient-alpha

```shell npm install gradient-alpha --save ```


Version published
Weekly downloads
3
Maintainers
1
Install size
17.9 kB
Created
Weekly downloads
 

Readme

Source

Installation

npm install gradient-alpha --save
<script src="js/gradient-alpha.js"></script>

gradient

Features

generate ImageData or Canvas from Image or ImageData by alpha options; 生成新的渐变透明度图片或ImageData.

Methonds

linear:

 gradient.linear< T extends HTMLImageElement|ImageData>(img:T, angel: number = 90, stops: number[] | Array<[number, number | string]> = [0, 1],alphas?:number[]):T

img - ImageData|HTMLImageElement;

angel - number;gradient direction,range:[0,360];

stops - [[number,number|string]...];alpha sections;like [[0,"0"],[1:"100%"]];frist param is alpha,second param is length(range[0,1] or range["0","100%"]);

example:
gradient.linear(new Image(),45,[[0,"0"],[0.3,"50%"],[1,"100%"]])

FAQs

Last updated on 26 Jan 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc