I would like to do some simple animating (mostly text animation) in ClojureScript. I am essentially a Javascript and web programming newbie, so the proposed solution doesn’t have to conform to any particular paradigm. However, since I will be playing around a lot, I would very much like to be able to livecode. So far I have tried quil with the lein template for figwheel-main (with Reagent) and that almost worked: the page livecodes fine, but the canvas that quil draws disappears when I update it and I have to reload the page. Since I am not sure that this approach even makes sense, I thought I would try to find out what solution I should be using, before sinking a bunch of time into debugging.
I think you need to have the canvas component be long-lived more-or-less, and all of your live coding pieces are happening in functions that the canvas is using for draw/update state etc.
As an aside, you can use regular SVG from react and animate their properties with ratoms. You can also probably accomplish a lot with CSS animations (yet another web tech to learn , but it can be worthwhile). SVG Sample is an example.
The quil documentation advises the use of the q/defsketch macro instead of q/sketch, but it also doesn’t include Reagent so perhaps I shouldn’t have dismissed q/sketch so readily. Looking at this, it makes sense that the canvas should be controlled within a component instead of floating alongside it. Thank you, I will give something like this a try (and maybe update the documentation while I’m at it). This approach would also help me to better understand Reagent, I think.
Thanks also for the SVG suggestion, I have looked at it a little but not very seriously. Something relatively lightweight that doesn’t require too much stuff to interact with other stuff is always appealing.
After making games for 2 years I found graphical live coding painful in Clojure/Script, so I ended up making Freja - an editor specifically designed for playing around with graphics. Write some draw-text and rl-scalef calls, hit Ctrl+L and see it fly.
It’s a new language but been using it for a year and it generally works well. Currently employed 50% making games in Freja.
I wouldn’t recommend Janet for corporate stuff, since Clojure has a lot going for it in that space. But if you want to live code graphics I’ve found Janet to be great!