Drawing mandalas with PHP for my Papa


Update, Jan 2015: I’ve rewritten this in JavaScript: Drawing mandalas with JavaScript and canvas

A sample mandala I have generated

The earliest memories I have of computers is a contraption my dad rigged up that would draw mandalas on a screen. Later in my life he wrote software that would plot large mandalas on his huge plotters.

In my last project, I learned about image generation using PHP and realized that it might be possible to use PHP functions to draw mandalas. After a couple hours of relearning trig, I was able to create a script that outputs a .png image of a mandala based on the size and number of points that you give it.

Give it a try:


Source code