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

proto-arrows

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proto-arrows

Utility functions for drawing beautiful arrows using cubic bezier paths

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

proto-arrows

License:MIT build Type Declarations

A set of utility functions for drawing beautiful arrows using cubic bezier paths. Inspired by perfect-arrows.

Why proto-arrows? Because cubic bezier curves look delicious for prototyping software like Sketch or Figma. So, why not make a library that simplifies the process of drawing them too?

Example Usage

An Arrow component in React

import React from 'react'
import {
  getCurve,
  interpolateCubicBezierAngle,
  getCubicBezierSVGPath,
} from 'proto-arrows'

export function Arrow() {
  const curve = getCurve({ x: 128, y: 128 }, { x: 256, y: 256 })
  const svgPath = getCubicBezierSVGPath(curve)
  const endAngle = interpolateCubicBezierAngle(curve, 1)

  return (
    <svg
      viewBox="0 0 512 512"
      style={{ width: 512, height: 512 }}
      stroke="#000"
      fill="#000"
      strokeWidth={3}
    >
      <circle cx={curve.start.x} cy={curve.start.y} r={4} />
      <path d={svgPath} fill="none" />
      <polygon
        points="0,-6 12,0, 0,6"
        transform={`translate(${curve.end.x},${curve.end.y}) rotate(${endAngle})`}
      />
    </svg>
  )
}

Special Thanks

Keywords

FAQs

Package last updated on 19 Aug 2022

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