Sha256: 44a0eb82ec3398ee63a6df5aab103f1b002082eac2d129f656d8519cbc0829e7
Contents?: true
Size: 809 Bytes
Versions: 30
Compression:
Stored size: 809 Bytes
Contents
# 2D Canvas [View full source code][code] or [view the compiled example online][online] [online]: https://rustwasm.github.io/wasm-bindgen/exbuild/canvas/ [code]: https://github.com/rustwasm/wasm-bindgen/tree/master/examples/canvas Drawing a smiley face with the 2D canvas API. This is a port of part of [this MDN tutorial](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_shapes#Moving_the_pen) to `web-sys`.  ## `Cargo.toml` The `Cargo.toml` enables features necessary to query the DOM and work with 2D canvas. ```toml {{#include ../../../examples/canvas/Cargo.toml}} ``` ## `src/lib.rs` Gets the `<canvas>` element, creates a 2D rendering context, and draws the smiley face. ```rust {{#include ../../../examples/canvas/src/lib.rs}} ```
Version data entries
30 entries across 30 versions & 1 rubygems