0
How can I turn code into art?
I would like to know how to generate fractals or geometrical designs with color using code. How would I go about accomplishing this task, what do I need to know?
5 Respostas
+ 4
For the mandelbrot set:
- How to get pixels on the screen, that depends on the language you want to use
- Complex numbers. The mandelbrot set is given by z' = z² + c, where z and c are complex, so you need to know how to square a complex number and how to implement it in code (it's not hard, you can look it up)
- Linear mapping. If you graph the mandelbrot set, the interesting portion is around between -2 and 2 on the x-axis and -1.5 and 1.5 on the y-axis. If you are generating say a 1000x800 image you'll need to know how to transform your pixel coordinates into the "interesting" range. (Not hard either, just a fancy name)
The mandelbrot is a pretty simple one, you can usually get something nice in some 20 lines of code. If you need help with anything just let me know.
+ 4
The main tip I'd like to share with anyone trying to mix art and software is to make it exciting to interact with. Unlike most paintings, photos, videos, sculptures... software can truly engage the user in the creative process. Failing to engage the user is a big wasted opportunity.
It sounds like you need some inspiration and working examples to spark your imagination.
You might get some ideas from a couple codes I published including:
- An interactive rose at https://code.sololearn.com/W91TjdF3PvD9/#html The peddles are drawn with colourful div elements in a spiral pattern.
- Sololearnski Carpet Fractal Viewer at https://code.sololearn.com/WVhoMHzy3K81/#html Although a lot of it was inspired by the Sierpinski Carpet invented decades ago, I like to think it is somewhat original and creative.
+ 1
see my code to generate and zoom into mandelbrot set fractal, using html5 progress and worker, css, javascript and some math
https://code.sololearn.com/WNvSp3Q9S5GD/?ref=app
https://www.sololearn.com/discuss/1196672/?ref=app
+ 1
I created a new 3D fractal viewer that is a good example of turning code into art.
It is at:
https://code.sololearn.com/W6e6xWN0T7Jv/
It lets you view a 3D cloud made from the Julia Set fractal with its imaginary C value varying across one of the cloud's dimensions.
I also created something to visualize a function that turns any 3 real numbers (x, z, t) to a single real number. It defaults to a Julia Set fractal function and visualizes it in colours of an image that animates as t moves through time.
https://code.sololearn.com/WCuL2WGCwUjm/
The code for this grapher is simpler than the first code I linked to because it is pure JavaScript with no WebGL or shaders.