Skip to main content
100%

Scribble.js

✓ Published0🌍 Public
Aabernier
Last edited Mar 7, 2016
Created on Aug 2, 2015

Scribble.js animates the drawing of an SVG path by progressively revealing its stroke. It uses the `getTotalLength()` method to measure each path, sets `stroke-dasharray` and `stroke-dashoffset` to hide the line initially, and then tweens the offset to simulate hand-drawn scribbling. The example includes an inline SVG (rendered as a stylized text-like design) with several paths, and a script that applies a 3-second erase-and-draw animation loop to each path sequentially using the Tween.js library, with the overall animation driven by requestAnimationFrame.

AI-generated description

Trace SVG paths.

INSTALL

npm install https://gist.github.com/abernier/e082a201b0865de1a41f/archive/42f199f7137d4e5137b4e2f879f58db2c213d8c9.tar.gz

or

<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore.js"></script>
<script src="https://rawgit.com/tweenjs/tween.js/v16.3.4/src/Tween.js"></script>
<script src="https://rawgit.com/caolan/async/v1.5.2/dist/async.js"></script>
<script src="https://rawgit.com/abernier/e082a201b0865de1a41f/raw/69eeade18397b8ac525e5d022b4876d98d838ccb/index.js"></script>

USAGE

see: https://gist.github.com/abernier/e082a201b0865de1a41f#file-index-html-L31

ISC Licensed

Similar vizzes