Every little fish swimming around is a visitor on this page right now, and one of them is you ( ´ ▽ ` )ノ If they get in the way of reading, feel free to turn them off.
Rube Goldberg Clock
utilA clock built the hard way.
The same idea as the Rube Goldberg Form.
Tech Keywords
Section titled “Tech Keywords”| Name | Description |
|---|---|
| SVG | Graphics format usable in the DOM, great for complex shapes and animation; combined with Vue v-bind it enables data-driven effects |
| SVG Mask | SVG masking that controls which areas of an element are visible, enabling complex shape cutting and masking |
| JS Animation | JavaScript-driven animation for more complex, precise control; popular libraries include GSAP and anime.js |
| Physics Simulation | Simulates real-world physics such as gravity, collisions, and velocity |
| CSS Animation | Implemented with CSS transition and animation |
Usage Examples
Section titled “Usage Examples”Basic Usage
Section titled “Basic Usage”<template> <div class="w-full flex justify-center p-6"> <util-rube-goldberg-clock /> </div></template>
<script setup lang="ts">import UtilRubeGoldbergClock from '../util-rube-goldberg-clock.vue'</script>How It Works
Section titled “How It Works”The pan is the clock weight. Once the ball lands in it, the seconds pendulum holds the escape wheel and lets the pan sink one notch per second; the last notch drops exactly on the minute and presses the trip lever that releases every cocked rod.
The lap has eight switches, and each one takes the other branch every minute. The front branch keeps going the same way round, while the back branch mostly runs backwards or goes up and down.
Every part's position is computed only from how many milliseconds of the current minute have passed, so nothing drifts, even after the tab has been in the background.
Source Code
Section titled “Source Code”interface Props { /** 主色,用在球與「現在」。@default 'light-dark(#f43f5e, #fb7185)' */ color?: string; /** 時間倍率,預覽用。2 表示快一倍。@default 1 */ timeScale?: number; /** 起始時間,格式 'HH:MM:SS',預覽用;不給就用現在 */ startAt?: string;}const emit = defineEmits<{ /** 整分時彈簧桿換好數字,time 是剛開始的那一分鐘 */ arrive: [time: Date];}>()If you have any suggestions or questions, feel free to email me( ´ ▽ ` )ノ
If you like cool components, feel free to " Buy me a cup of coffee " to show your support!