components / pencil-rule
pencil-rule.
a rule that draws itself with a pencil riding the leading edge. the stroke is a scaled element rather than an animated width, so it composites and never causes layout; the pencil shares the stroke's timing function, which is what keeps the nib pinned to the end of the line. draws on scroll-into-view by default. under reduced motion the finished rule renders immediately and the pencil never appears.
odd jobs, done properly.
the rule draws left to right and the pencil leaves once it lands.
installation
bunx @justin06lee/chrome@latest add pencil-ruleprops
| name | type | default | description |
|---|---|---|---|
| duration | number | 1.2 | seconds to cross the full width. |
| delay | number | 0 | |
| trigger | 'in-view' | 'mount' | 'in-view' | |
| repeat | boolean | false | redraw every time it re-enters the viewport. |
| thickness | number | 1 | line thickness in px. |
| color | string | 'rgba(255,255,255,0.35)' | |
| pencilColor | string | 'rgba(255,255,255,0.75)' | |
| showPencil | boolean | true | false draws the line alone. |
| className | string | - |