November 2011
Intermediate to advanced
348 pages
7h 2m
English
For the mechanics and engineers out there, this one's for you. In this recipe, we'll create a system of interconnected rotating gears.

Follow these steps to animate a system of interconnected gears:
Animation class:<head>
<script src="animation.js">
</script>Gear class: <script> function Gear(config){ this.x = config.x; this.y = config.y; this.outerRadius = config.outerRadius; this.innerRadius = config.innerRadius; this.holeRadius = config.holeRadius; this.numTeeth = config.numTeeth; this.theta = config.theta; this.thetaSpeed = config.thetaSpeed; this.lightColor = ...Read now
Unlock full access