Skip to main content
Public

Share visualization

Loading preview…

truck for kids

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

truck for kids

0
Vvenigallajaanu@gmail.com
Last edited Feb 24, 2025
Created on Feb 22, 2025

Built with D3.js v7, this example draws a cartoon truck as an SVG composition of rectangles and circles, including a red body, blue cabin, white window, yellow backlight, and two black wheels. Clicking the truck triggers a two-second `transition` that translates the entire group horizontally across the canvas, while the wheels rotate 720 degrees via `transition.attrTween` and `d3.interpolateString`. The wheels spin independently during the movement, and repeated clicks restart the animation, making the truck advance slowly across the gray-bordered SVG stage. It demonstrates reusable transition chaining on grouped SVG elements.

AI-generated description

D3.js Animated Truck

here i am creating a simple truck with the d3.js, wher it will move with the rotation

🚀 Features:

  • -click the truck to move it backwork
  • clik once it will go to last
  • click continously it will move slowly- Wheels spin while the truck moves.
  • Bdone by using the SVG and built in functions

🛠️ How to Run:

just run the html file 2. after exection click the truck for the animation

🎨 Components:

-main body in (rectangle)for the base

  • cabin(rectangl)in rectangle for users
  • window(rectange) for crossing
  • light(circle)for indication
  • wheels(circle) for motion.

Comments

Sign in to join the discussion.

MIT Licensed