Earth Moon Emoji Orbit

Earth Moon Emoji Orbit

January 1, 2023

example p5.js javascript arrays genuary

I created this for the first day of Genuary 2023 which had a prompt of “Perfect loop / Infinite loop / endless GIFs”.

This sketch uses cos() and sin() to show the moon orbiting the earth. It also uses arrays of emojis to animate the earth and moon rotating.

Edit this code in the p5.js editor.

Edit this code in the p5.js editor.

emoji moon orbiting emoji earth

Remix Ideas

  • Make the earth orbit the sun. 🌞
  • Add stars ⭐🌟✨
  • Add rockets, satellites, or aliens! 🚀🛰️☄️👽👾🌌🪐

Arrays Examples


Happy Coding is a community of folks just like you learning about coding.
Do you have a comment or question? Post it here!

Comments are powered by the Happy Coding forum. This page has a corresponding forum post, and replies to that post show up as comments here. Click the button above to go to the forum to post a comment!