npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

drawn-line-paint-worklet

v1.0.3

Published

CSS paint worklet for squiggly lines that look hand-drawn.

Downloads

27

Readme

Drawn Line CSS paintWorklet

Text showing a wobbly underline, that looks almost hand-drawn

This really simple paint worklet allows you to draw a horizontal line at the bottom of elements that looks hand-drawn, ish. I made this mostly because I really wanted to have a hand-drawn look for my text-underlines. That's also the reason for why you can't customize for every possible situation. But you could just take the code in worklet.js and adopt it to your liking!

Install it to your project

Paste ye olde npm code into the semi-transparent dark window of your choice:

npm i drawn-line-paint-worklet

And then process the files further to your liking. If you don't do that in your project, going the NPM route is not the way to go. Instead, copy and paste the code, or utilize the CDN.

Via CDN

<script src="https://unpkg.com/[email protected]/dist/worklet.js"></script>

Make sure to also register the custom properties. See instructions further below.

Adding the Paint Worklet

If you have the files available to you locally, you can rely on register.js to do everything:

<script type="module" src="register.js"></script>

The type="module" may not be needed, depending of whether and how you process the file(s) in your project. This is not gonna be possible to do with

register.js registers the paint worklet and it registers the CSS custom properties via CSS.registerProperty() that you can use to adjust the line generation. This is important, because the CSS typed OM allows for intuitive and easy processing of values.

You can of course do this yourself, if you'd like to do so. In that case, refer to the worklet.js file for the paint worklet code and refer to the properties.js, or take them to CSS and register them in CSS with @property instead - whatever you prefer. But make sure that you do not skip the step of registering the custom properties in some way, otherwise the worklet will not work correctly.

Custom Properties

These are the properties that the paint worklet registers:

| property | purpose | default | |---|---|---| | --drawn-line-color | <color> - set a color for the line | black | | --drawn-line-strength | <length> - set the thickness of the line | 2px | | --drawn-line-wiggle | <integer> - adjust how wiggly the line is | 1 | | --drawn-line-curve-range | <length> - set how high the line can wiggle to the top | 1px | | --drawn-line-segment-size | <length> - set the size of an individual segment, in which curves are being generated | 12px |