canvasteste
✓ Published0🌍 Public
This example demonstrates basic canvas drawing and animation within a VizHub page. It uses a D3 selection to set the text of a message div, then draws a red rectangle and a series of horizontal lines on a 600x300 canvas via the Canvas 2D API. A button triggers a `myMove` function that animates the canvas element by incrementing its CSS `top` and `left` positions with `setInterval`. The code imports `select` from D3 and a local ES6 module for the message text.
AI-generated descriptionAn example showing the capabilities of VizHub:
- Loads D3 via UNPKG.
- Demonstrates use of
importfrom"d3". - Demonstrates use of
importfrom local ES6 modules.
MIT Licensed