For my generative landscape, I use Perlin noise function to create a nebula in the middle. In terms of the nebula, I took FlowField and StarField code from Danial Shiffman as a reference. It was originally starting at t random position, flowing around the screen randomly, and the edge, which makes the particles bound back instead of flowing outside the screen, is set as a rectangle. So, I change the starting point to the center, and change the bounding edge from a rectangle shape to a circle, and use a if function to make it bound back toward the center if it grows bigger than the confining circle, which gets larger according to the framecount. The color for the nebula changes depending on the distance of the particles and the center. I also add a MouseIsPressed function to make this project more interactive, so if you hold down the left mouse button, another color will shows. I use a secondary background for the nebula in order to preventing it being affected by the background for stars and fafafish. As for the stars and the fafafish, I firstly create them at a random position on the screen, and add a variable to make it originates at the center and looks more 3D. It moves faster as it gets closer to the front.
The difficulty I met for this project would be that controlling the color and the speed of each elements, especially the color and the speed of nebula, because these data are changed based on the distances between particles and the center. To solve this problem, I keep testing different numbers, and use pow or sqrt to make the date more precise.
Link: https://www.openprocessing.org/sketch/623516
Reference:
Shiffman, Daniel https://github.com/CodingTrain/website/find/master
You must be logged in to post a comment.