Skip to main content
Public

Share visualization

Loading preview…

Fork of New template

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Fork of New template

1
Vvenigallajaanu@gmail.com
Last edited Feb 22, 2025
Created on Feb 22, 2025
Forked from New template

This example shows an interactive truck built from SVG shapes: a red body, blue cabin, white window, yellow headlight, and two black wheels. Clicking the truck triggers a two-second animation that translates it to the right, and the wheels rotate 720 degrees around their centers. The code uses D3.js v7 to select the SVG container, append shape elements, and animate the truck’s movement and wheel spinning with a transition and `attrTween`.

AI-generated description

D3.js Animated Truck

This project creates a simple truck using D3.js. The truck moves when clicked, and the wheels rotate.

🚀 Features:

Click the truck to make it move forward.

  • Wheels spin while the truck moves.
  • Built using D3.js and SVG elements.

🛠️ How to Run:

Open index.html in a browser. 2. Click the truck to see the animation!

🎨 Components:

Truck Body* (red rectangle)

  • Cabin (blue rectangle)
  • Windows (white rectangle)
  • Headlights (yellow circle)
  • Wheels (black circles that rotate)

Enjoy! 🚚✨

Comments

Sign in to join the discussion.

MIT Licensed