react-gsap Docs
Introduction
Components
Plugins
GSAP PluginsCountPluginSvgDrawPluginSingle NumberTupleAll possible SVG elements
Instructions

SvgDrawPlugin

The SvgDrawPlugin is shipped with react-gsap and lets you animate SVG elements. You can draw the following SVG elements: path, circle, rect, line, polyline and polygon.

It works similar to the DrawSVGPlugin from GreenSock but the parameters are a little different.

It can be called with the "svgDraw" property and takes a single number (0-1) value or an array with two numbers (Tuple) ([(0-1), (0-1)]).

The single or first number is the length of the stroke.

The second value is the position/offset on the path. (default = 0)

So you can animate a line drawing from start to end like that:

import { Controls, PlayState, Tween } from 'react-gsap';

Single Number

Tuple

An animation from the middle to the outside:

All possible SVG elements