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

canvas-pattern

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

canvas-pattern

Draw and cache a repeated pattern on a canvas context.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

canvas-pattern

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

Draw and cache a repeated pattern on a canvas context.

paypal coinbase twitter

Installation

npm install canvas-pattern

Usage

import canvasPattern from "canvas-pattern";
import createCanvasContext from "canvas-context";

const { context } = createCanvasContext("2d");

const pattern = new Image();
pattern.src = "pattern.png";

drawImagePattern(context, pattern);

API

Modules

canvasPattern

Typedefs

CanvasPatternRepetition : "repeat" | "repeat-x" | "repeat-y" | "no-repeat"
CanvasPatternOptions : Object

Options to draw. All optional.

canvasPattern

canvasPattern(context, source, [options]) ⇒ CanvasPattern

Draw and cache a repeated pattern on a canvas context.

Kind: Exported function

ParamTypeDefaultDescription
contextCanvasRenderingContext2DThe context to draw the pattern to
sourceCanvasImageSourceThe pattern to be drawn
[options]CanvasPatternOptions{}The options to position the pattern and controls its repetition

CanvasPatternRepetition : "repeat" | "repeat-x" | "repeat-y" | "no-repeat"

Kind: global typedef

CanvasPatternOptions : Object

Options to draw. All optional.

Kind: global typedef
Properties

NameTypeDescription
[pattern]CanvasPatternThe CanvasPattern to draw. Created and returned by the function for reuse.
[repetition]CanvasPatternRepetitionA DOMString indicating how to repeat the pattern's image.
[x]number
[y]number
[width]number
[height]number

License

MIT. See license file.

Keywords

FAQs

Package last updated on 09 Nov 2021

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