BIT-101 Lab, One Month In

Jan 31 2017 Published by under JavaScript, Lab

Screenshot from 2017-01-30 21-11-22

So… that went pretty well. One full month of posts done. I wasn’t sure how long I’d last before we started seeing gaps in the lineup. But this is easier than I was expecting. Turns out, I have a lot of ideas. To be honest, and to possibly spoil some illusion, I’m actually a bit ahead of the game. Some days I have more than one idea, or I come up with one or two iterations to something I just did. If so, I just go ahead and bang out whatever is in my mind and postdate it. This also takes the stress off having to come up with something brand new every single day. While generally not a problem, some days I might be really busy, or exhausted, or even sick. Having a buffer on those days is really helpful.

My biggest realization on this whole exercise is how many cool sketches I’ve been able to come up with and how easy it is in general. There are various pieces of advice, exercises, motivational sayings, etc. that say if you force yourself do do something every day for so many days… something magical will happen. Or something. For all the new-age, pop-psychology, “one weird trick” dubiousness of those things, there does seem to be something there.

Although it feels like creativity should be something that needs to flow naturally from some unseen source, it can very definitely be forced, or at least jump started. Force yourself to create something every day and suddenly you’ll have more ideas than you can document, much less act on.

To be fair, some of these ideas are revisitations of things I did years ago in the Flash-based lab. But I think I’m taking them in new and interesting directions, and probably have a better presentation of them as well. Even so, all that stuff was at more than 11 years ago. Some of it going on 16 years ago. There may be new viewers who were not even born when some of this came out originally.

A lot of the things I’m exploring is stuff I originally posted on Art From Code. The source for that stuff was never released. And in fact, most of it is long gone. So I find myself reverse engineering my own past work in a lot of cases. “How the HELL did I do that???” One was baffling me for many days, till I finally dug up a source file hidden away in DropBox. Sad that it had to go that way, but happy I found it.

I’ve also done a lot of work on the site interface as well. I got it pretty near where I want it at this point, though there are a few improvements that need to be added. And it will still evolve over time. But I was really happy with the tags searching, thumbnail index, the sorting and sizing of thumbnails, the saving of preferences and the history / clear history feature in the calendar. Most of that is way beyond what I originally had planned on day one. A lot of it still needs to be cleaned up, but I’m happy with the functionality anyway.

Screenshot from 2017-01-30 21-11-36

I also did a lot of work on the daily page templates. Initially, as I changed some aspect of how it worked, I’d have to go through all of the previous days and edit them all to keep the past days in line. Now, most of the daily UI – beyond the experiment code itself – is done via a UI script. So when I want to change how the daily UI looks, I just change the script and all the days update when they load. That saved me hours already. I toyed with the idea of having a single index that gets a query param of the date it needs to load. That could work, but I’m sticking with individual HTML files for each experiment. This allows me to load individual libraries for one experiment, such as Perlin noise or something else, without having to use some kind of module loader. Or I can make some one off changes or customization to a single day’s experiment, without jumping through hoops.

One last aspect I wanted to mention. This goes back to the creativity aspect. A few years back I did a talk at a few conferences, which I think was also entitled “Art from Code”. In it, I went a bit into left-brain / right-brain theory. I mentioned that while there is a biological basis for the left/right stuff, new age pop psychology has taken the whole theory way beyond reality. However, I did acknowledge that there are different modes of coding, some of them conducive to creativity, some less so.

For example, say you have some creative idea and an concept of how you want to code it. You open up an editor and… create an HTML file, give it a name, figure out where to save it on your disk, give it a head, title, body, import some libraries, add a canvas to the stage, maybe some CSS, add the main JavaScript file to the HTML, create that file, get a reference to the canvas, get the context… now, what was that idea you had? It’s probably gone.

Basically all that analytical, naming, organizing, structuring activity pulls you right out of the cool idea mode you were in. Blame it on brain hemispheres, or don’t. It happens. This is perhaps one reason why the Processing language is so popular among creative coders. You launch processing, you start typing, you hit “run”. BAM!

So part of my flow is a templating system and some creation scripts, as well as the various libraries I’m using. Say I have an idea for something I want to publish on June 12 (no, I’m not that far ahead of myself yet). I just type in the console:

mkdaily.sh 170612

and the HTML and JavaScript files are created and ready to start typing code into. I’ve been using JetBrain’s WebStorm, which has a built in terminal window, so it’s always ready. Say I like what I did on the 12th and I want to iterate it a bit on the 13th. Rather than copy the two files and manually edit them, I type

cpdaily.sh 170612 170613

and it copies the original experiment into the new one, changing the date, links, etc. I just need to iterate the code, update the description, etc. Both of these scripts, as well as the templates, are there in the repo if you want to get a better idea how that works. And yeah, they guard against overwriting existing files if I type in the wrong input. Anyway, all that has been hugely useful in keeping me in creative mode, and away from housekeeping and setup work when I have a good idea.

In summary, I’m on a roll and don’t seem to be slowing down. I’m certain I’ll bat 1000 again for February. Then we’ll see how March goes.

3 responses so far. Comments will be closed after post is one year old.

Leave a Reply to YOHAMI Cancel reply