12/28/2023 0 Comments Kaleidoscope gif generatorThere’s been a lot of uncertainty for everyone, a lot of death, and a lot of fear. It’s worth mentioning, because it might not be so obvious in the future, that these projects and this bootcamp were done during the COVID-19 pandemic of 2020. Just implement it and work with it a bunch and it will start to make sense. You don’t have to understand it right away. I feel like redux (as well as a lot of coding challenges) are best understood through repetition. If you’re new to redux or similar state management frameworks, it can be a lot. That took me while to get my head around. ![]() One of the requirements for this project were that we incorporate redux into our React app. The first block is from my CreateSketches component, while the second is from my sketch actions (redux). Here’s how I sent my p5js visual data to my backend. Here’s a stackoverflow article about how to inspect it. If you try to look at a key you put into your FormData in the developer console it will come back empty.Īny methods that exist on FormData return iterators, so you can’t see anything you call on it unless you actually iterate over it. If you haven’t worked with FormData before, it behaves very strangely, and it’s not that straight-forward to inspect it. Additionally, you can’t send binary as json (as far as I know), so FormData came to the rescue as a means of shipping the binary to my backend. I used a query selector to access the p5.js canvas, converted it to a blob, and then put that blob into FormData. It takes an html element and converts it to binary (which is essentially what a blob is). Obviously the information I needed to persist to my database existed. But what if I just want to send it straight to my backend? And wouldn’t that be rude to save that image to the user’s computer just so I can have it in my server? Writing code to let a user save an asset to their local hard drive is a relatively easy thing to do. Now that I had a react-p5 proof of concept, I needed to know whether or could successfully send a p5 sketch to my backend as an image, persist it, and then be able to render it to my front end. ![]() The generator helps scientists replicate how light is transferred through the atmospheres of planets, exoplanets, moons, and comets in order to understand what their atmospheres and surfaces are made of.The p5 code I ended up implementing for my react-p5 experiment ended up being very much based upon the Coding Train’s Kaleidescope Snowflake Challenge by the famous Dan Shiffman (who was a former professor of mine). These sky simulations are now a new feature of a widely used online tool called the Planetary Spectrum Generator, which was developed by Villanueva and his colleagues at NASA Goddard. Also on Mars, the sunset turns from a brownish color to a blueish because the Martian dust particles scatter the blue color more effectively. The halo of light seen towards the end of the sunset on hazy Earth is produced because of the way light is scattered by particles, including dust or fog, that are suspended in the clouds. The animations show all-sky views as if you were looking up at the sky through a super wide camera lens from Earth, Venus, Mars, Uranus, and Titan. The white dot represents the location of the Sun. ![]() The result is a lovely palette of colors that would be visible to those standing on these worlds. As these worlds rotate away from the light of the Sun, which is what happens during a sunset, photons get scattered in different directions depending on the energy of the photons and the types of molecules in the atmospheres. The animations show the Sun appearing to set from the perspective of someone on these worlds. To validate the accuracy of his tool, Villanueva simulated known sky colors of Uranus and other worlds, some of which are shown above. One day, a probe could descend through the Uranian atmosphere, with Villanueva’s tool helping scientists interpret the measurements of light that will reveal its chemical makeup. Geronimo Villanueva, a planetary scientist from NASA’s Goddard Space Flight Center in Greenbelt, Maryland, created the sunset simulations while building a computer modeling tool for a possible future mission to Uranus, an icy-cold planet in the outer solar system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |