Setup
Install ThorVG to start rendering vector scenes and Lottie animations.
You can download the ThorVG tarball via the Releases link. The latest version is recommended. ThorVG supports the meson build system. Install meson and ninja if you don't have them already.
Both the C and C++ APIs are part of the same compiled library, so the build steps below are identical regardless of which one you plan to use.
Run meson to configure ThorVG in the thorvg root folder.
meson setup builddir
Run ninja to build and install ThorVG.
ninja -C builddir install
Regardless of the installation, all build results (symbols, executable) are generated in the builddir folder in thorvg. Some results such as examples won't be installed — see the More examples section to see how to change it.
Note that some systems might include the ThorVG package as a default component. In that case, you can skip this manual installation.
Build with Visual Studio
If you want to create Visual Studio project files, use the command --backend=vs. The resulting solution file (thorvg.sln) will be located in the build folder.
meson setup builddir --backend=vs
Build with Xcode
If you want to create Xcode project files, use the command --backend=xcode. The resulting project file (thorvg.xcodeproj) will be located in the build folder.
meson setup builddir --backend=xcode
Include the header
As the prerequisite for the rest of this guide, include the ThorVG header in your source code.
#include <thorvg_capi.h>
#include <thorvg.h>
ThorVG WebCanvas is available via NPM-based package managers (npm, yarn, pnpm) and can also be accessed through the unpkg CDN. The latest version is recommended.
Install via NPM
Install ThorVG WebCanvas via npm:
npm install @thorvg/webcanvas
Then import it in your TypeScript or JavaScript code:
import ThorVG from '@thorvg/webcanvas';
Install via CDN
For quick prototyping or simple projects, you can use ThorVG WebCanvas directly from a CDN without any build tools.
<script src="https://unpkg.com/@thorvg/webcanvas@latest/dist/webcanvas.js"></script>
Once installed, continue to the Guide to draw your first shape.