How to draw a crescent

Thanks for the link Jeremy! I’d like to learn much more about astronomy actually. I took a year of it in school decades ago but I’ve forgotten most of it by now. Curiously, that’s the last time I took a formal programming class and the language we used was … Pascal! I also have very little memory of that, aside from spending a lot of time looking for missed semicolons on that big green bar paper printers used to use. :slight_smile:

No problem Dan.

Reading some of the posts and answers on this Processing site there is not very much (how about nothing !!) that I can contribute as it is “way out” of my field of expertise. It looks as if there is not a great deal that I can contribute here.

Cheers,

Jeremy.

Well I’m glad you contributed to this post!

It works for me - just in case you were still waiting for an answer.
And it was animating just now - don´t know if you did anything to the code since you posted here

When you say it animates, do you see the moon go through all of its phases, with the light continuously circling the sphere?

I don’t… I see the light kind of animating in on the left side, and then stopping. Which is odd, considering sin(frameCount) should continue to swing between -1 and 1… ?

1 Like

Now you asked specifically…
I saw what you described and thought it was animating slowly and I ran out of patience.
My bad.
To make up for it: as you linked your sketch in the editor I had a little poke and some Reference-reading and came up with one additional line

  let angle = frameCount/20.0; //was frameCount/10.0
  moonPG.reset();                    //was missing
  moonPG.directionalLight(255, 255, 255, cos(angle), 0, sin(angle));

Of course I didn´t save into your code - but I learned something about rendering

2 Likes

Awesome! Changed it to include the reset. Thanks for finding that!

1 Like