Not like it would be impossible, but I think that trying to program a realistic dynamical model of planetary gears in Glowscript would be pretty big project since you have all kinds of contact forces at weird angles and on surfaces that Glowscript is good at rendering but not super good at keeping track of to check for contact. This type of functionality is built into many engineering design software packages, so I wouldn't reinvent the wheel. You might want to check out
OnShape, which lets you do this and is free for educators and students. It runs in your browser so you don't need to install any software on your computer.