New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

image-permutation

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-permutation

一个图片排列工具

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

image-permutation

一个图片排列工具

安装

npm i --save image-permutation

基本使用

<script src="https://unpkg.com/image-permutation/dist/image-permutation.umd.js"></script>
<script>
    var source = new Image()
    source.crossOrigin = 'anonymous';

    source.onload = function() {
        
        const config = {
            width: 100,
            rotate: 0,
            cross: true,
            mirror: {
                x: false,
                y: false
            },
            random: {
                width: 0,
                rotate: 0
            },
            gutter: {
                horizontal: 20,
                vertical: 20,
            }
        }

        new ImagePermutation(1000, 1000, '#ff0000', [source], config).draw().then(data => {
            var result = document.getElementById("result")
            result.src = data
        })
    }

    source.src = "./item.png"
</script>

参数

new ImagePermutation(width, height, backgroundColor, source, config)

属性说明数据类型默认值
widthcanvas内部的宽度number-
heightcanvas内部的高度number-
backgroundColorcanvas背景颜色string#fff
source插入的image对象数组Array[]
config配置文件Json{}

config数据结构

{
    width: 100, // 插入image宽度
    rotate: 0, // image旋转角度
    cross: true, // 是否穿插渲染
    mirror: { // 镜像渲染
        x: false, // x轴镜像
        y: false  // y轴镜像
    },
    random: { // 随机渲染
        width: 0, // 宽度随机增量
        rotate: 0 // 角度随机增量
    },
    gutter: { // 间隔
        horizontal: 20, // 水平间隔
        vertical: 20, // 垂直间隔
    }
}

FAQs

Package last updated on 07 Jan 2019

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