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
ctx.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
end
end
As stated earlier, you can do animations, an example:
https://sol.vin/images/generative_art/chromatic_aberration/0.svg
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 https://sol.vin/art/live/inward
Anyone else using Crystal for this kind of stuff?