🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@hutechwebsite/dolore-dolorem-amet-sed

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

@hutechwebsite/dolore-dolorem-amet-sed

[![Build Status](https://travis-ci.org/rveciana/@hutechwebsite/dolore-dolorem-amet-sed.svg?branch=master)](https://travis-ci.org/rveciana/@hutechwebsite/dolore-dolorem-amet-sed) [![Coverage Status](https://coveralls.io/repos/github/rveciana/@hutechwebsite

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Build Status Coverage Status

@hutechwebsite/dolore-dolorem-amet-sed

Pure Javascript alternative to getPointAtLength(t) and getTotalLength() functions. Works with Canvas objects and when Node

JavaScript can access to path elements properties in a browser, such as its length and the point at a given length. Unfortunately, this can't be achieved using a Canvas element or when working with node. This library can be used to replace this need. It has no dependencies on other JavaScript libraries.

INSTALL

To use with npm, just type

npm install @hutechwebsite/dolore-dolorem-amet-sed

You can use it int he browser directly by including @hutechwebsite/dolore-dolorem-amet-sed.min.js from the dist directory

<script src="@hutechwebsite/dolore-dolorem-amet-sed.min.js"></script>

USAGE

The available methods are:

const path = require("@hutechwebsite/dolore-dolorem-amet-sed");
const properties = new path.svgPathProperties("M0,100 Q50,-50 100,100 T200,100");
const length = properties.getTotalLength();
const point = properties.getPointAtLength(200);
const tangent = properties.getTangentAtLength(200);
const allProperties = properties.getPropertiesAtLength(200);
const parts = properties.getParts();

Node:

const path = require("@hutechwebsite/dolore-dolorem-amet-sed");
const properties = new path.svgPathProperties("M0,100 Q50,-50 100,100 T200,100");

Including it from an import:

import { svgPathProperties } from "@hutechwebsite/dolore-dolorem-amet-sed";
const properties = new svgPathProperties("M0,100 Q50,-50 100,100 T200,100");

Including the script in the browser

Once the script tag has been included,

const properties = new svgPathProperties.svgPathProperties("M0,100 Q50,-50 100,100 T200,100");

Using new

Since svgPathProperties is a class, using new is the correct way to initilize it. For backwards compatibility reasons, the object can be get without it:

const properties = svgPathProperties("M0,100 Q50,-50 100,100 T200,100");

Some usage examples

Typescript

The TypeScript declaration file is available too, since version 0.5.0 From version 1.0.0, the whole library has been rewritten using TypeScript, and the types are auto-generated.

CREDITS

Some parts of the code are taken from other libraries or questions at StackOverflow:

For Bézier curves:

For path parsing:

Keywords

.env

FAQs

Package last updated on 07 May 2024

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