# 示例

¥Examples

AssemblyScript 示例和 snippets

¥A collection of AssemblyScript examples and snippets.

# 入门示例

¥Starter examples

展示底层 WebAssembly 功能的小型娱乐程序。这些编译后的大小不到一或只有几千字节,因此它们的文本格式很容易掌握。

¥Small entertaining programs showcasing low-level WebAssembly capabilities. These compile to less than one or just a few kilobytes so their text format is easy to grasp.

# Mandelbrot

使用 JS 端计算的 2048 个离散颜色值将 Mandelbrot 集渲染到画布上。

¥Renders the Mandelbrot set to a canvas using 2048 discrete color values computed on the JS side.

easy

Preview image

# 干涉

¥Interference

将干涉图案动画化并渲染到画布上,同时将图片缓冲区保留在 WebAssembly 中。

¥Animates and renders an interference pattern to a canvas while keeping the image buffer in WebAssembly.

easy

Preview image

# 生命游戏

¥Game of Life

不断更新元胞自动机并根据用户输入在画布上可视化其状态。

¥Continuously updates a cellular automaton and visualizes its state on a canvas according to user input.

intermediate

Preview image

# 高级示例

¥Advanced examples

# 数组

¥Arrays

展示如何使用加载程序交换和处理数组。

¥Shows how to exchange and work with arrays using the loader.

intermediate

# 示例存储库

¥Examples repository

各种更高级的示例可作为 示例存储库 (opens new window) 的一部分,包括 使用加载器 (opens new window)创建(节点)库 (opens new window)使用浏览器 SDK (opens new window)使用转换钩子到编译器 (opens new window) 的复杂示例。

¥Various more advanced examples are available as part of the examples repository (opens new window), including a sophisticated example of using the loader (opens new window), creating (node) libraries (opens new window), utilizing the browser SDK (opens new window) and hooking into the compiler using transforms (opens new window).

# 其他资源

¥Additional resources

如果你有兴趣了解更多具体概念,请务必阅读 Wasm 举例 (opens new window)

¥If you are interested in learning more about specific concepts, also make sure to give Wasm By Example (opens new window) a read.