DEV Community

Emilio
Emilio

Posted on • Edited on

do you guys like the javascript code

https://codepen.io/etwas-deutsch/pen/MWZdjBo?editors=1000

here is the updated version

Top comments (6)

Collapse
 
cdoubleutj profile image
Cdoubleutj

Yeah, I like it. But you could improve it by using requestAnimationFrame instead of setInterval because it is much more precise and even handles frame drops. That way it will look smoother.

Grüße aus Rostock ;)

Collapse
 
emilio-lizarraga profile image
Emilio

thank you i will code that in a bit

Collapse
 
emilio-lizarraga profile image
Emilio

so i just going to get rid of the javascript and just make it an HTML so ja that's going to happen

Thread Thread
 
emilio-lizarraga profile image
Emilio

also um any other suggestions

Thread Thread
 
cdoubleutj profile image
Cdoubleutj • Edited

I think another cool thing would be to attach something like a moon to the planet that is orbiting the sun and let that moon orbit the planet. That way it will look like a planetary system. You could achieve this by creating position objects that hold x and y values and reference the position object of planet as anchor in moon. Because objects in javascript are passed by reference, you can then change the position of planet each frame (wich also changes the moon anchor because it is referencing the same object)

Take a look at this jsfiddle i made :)
Orbit Demo

Thread Thread
 
emilio-lizarraga profile image
Emilio

That is a good idea also the is really cool

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

Best practices for optimal infrastructure performance with Magento

Running a Magento store? Struggling with performance bottlenecks? Join us and get actionable insights and real-world strategies to keep your store fast and reliable.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️