skia2/site/user/modules/canvaskit.md
Bryce Thomas 1303a1a15c Fix CanvasKit generated documentation to work with emscripten 1.39.16.
In https://skia-review.googlesource.com/c/skia/+/291182 emscripten was updated
to 1.39.16.  This introduced a breaking API change to the CanvasKit
initialization callback, which becomes simply `then()` as opposed to
`ready().then()`.  In the course of this change, I missed a few `ready()` calls,
which has broken the examples in public-facing documentation.
E.g. https://skia.org/user/modules/canvaskit.  This CL fixes that.

Bug: NONE
Change-Id: I857b4653747cffc3870bf92d479dc88c3fd7d64a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292097
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-05-27 12:23:32 +00:00

30 KiB

CanvasKit - Skia + WebAssembly

Skia now offers a WebAssembly build for easy deployment of our graphics APIs on the web.

CanvasKit provides a playground for testing new Canvas and SVG platform APIs, enabling fast-paced development on the web platform. It can also be used as a deployment mechanism for custom web apps requiring cutting-edge features, like Skia's Lottie animation support.

Features

  • WebGL context encapsulated as an SkSurface, allowing for direct drawing to an HTML canvas
  • Core set of Skia canvas/paint/path/text APIs available, see bindings
  • Draws to a hardware-accelerated backend
  • Security tested with Skia's fuzzers

Samples

Paragraph shaping, custom shaders, and perspective transformation

SkParagraph JSFiddle
Shader JSFiddle
3D Cube JSFiddle

Play back bodymovin lottie files with skottie (click for fiddles)

Go beyond the HTML Canvas2D

Star JSFiddle
Ink JSFiddle

Lottie files courtesy of the lottiefiles.com community: Lego Loader, I'm thirsty, Confetti, Onboarding

Test server

Test your code on our CanvasKit Fiddle

Download

Get CanvasKit on NPM