The Crystal Programming Language Forum

Generative Art, Crystal, and Celestine

I’ve been using Crystal for Generative Art lately and the speed is amazing. I’ve found you can generate many times more samples than using something like Javascript. While I’d love to see something more like Processing for Crystal, I’ve been working on my own small DSL oriented solution for simple SVG. It’s called Celestine, and it’s a library for generating SVG images. It can handle all sorts of SVG functions, including certain minimal animations.

require "celestine"
Celestine.draw do |ctx|
  ctx.view_box = {x: 0, y: 0, w: 100, h:100}
  # draw a circle do |circle|
    # We are now configuring the circle
    circle.x = 10
    circle.y = 20
    circle.stroke = "black"
    circle.fill = "none"
    circle.radius = 10

    # Want to specify in css units? Try these handy patch methods
    circle.radius = 10.px
    circle.x = 10.percent
    circle.y = 10.vmax

As stated earlier, you can do animations, an example:

You can check out a gist of the code here.

I also have a live generator which generates images server side, you can check it out at

Anyone else using Crystal for this kind of stuff?


This is really cool!
I think I will certainly have a look at the svg generation, as base for creating cnc-tool-paths.


I’m actually super interested in getting a cnc mill for pen plotting. I’ve been deep into #plottertwitter. It looks so cool! Let me know if there is anything I can do to help you out in that regard.

Didn’t know #plottertwitter was a thing.
I will try to post here if I manage to get anywhere. I don’t have as much time as I would want for my cnc.