This is an attempt by Nina Paley (art) and Atul Varma (code) to tinker with procedural art.
 
 
 
Go to file
Atul Varma d1c2ae4b02
Always permalink to Mandalas. (#99)
This addresses #61 by making mandalas permalinked.

The URL to a mandala will change whenever the user stops fiddling with it for 250 ms.  This means that the user can always reload the page to get a reasonably recent version of what they were creating, and they can use the browser's "back" and "next" buttons to effectively undo/redo recent changes.  They can also copy the URL to share it with others.

## About the serialization format

Originally, I stored the state of the user's mandala in the URL using JSON.  This had a number of drawbacks, though:

* **It was really long.**  A mandala serialization was almost 1k characters, which was a very big URL, and one that some sharing platforms might even reject.

* **It wasn't type-checked in any way.** Unless I added some kind of JSON schema validation (which I didn't), the serialization was simply deserialized and assumed to be in the proper format.  This could result in confusing exceptions during render time, rather than decisively exploding at deserialization time.

To resolve these limitations, and because I thought it would be fun, I decided to store the mandala state using a serialization format called [Apache Avro][].  I first read about this in Kleppmann's [Designing Data-Intensive Applications][kleppmann] and was intrigued by both its compactness (a serialized mandala is around 80-120 characters) and schema evolution properties.

It might be going a bit overboard, but again, I thought it would be fun and I wanted to play around with Avro.  Also, I tried architecting things in such a way that all the Avro code is in its own file, and can easily be removed (or swapped out for another serialization format) if we decide it's dumb.

[Apache Avro]: http://avro.apache.org/
[kleppmann]: https://dataintensive.net/

## Other changes

This PR also makes a few other changes:

* Tests can now import files with JSX in them (I don't think this was required for the final state of this PR, but I figured I'd leave it in there for its almost inevitable use in the future).

* The value labels for number sliders now have a fixed width, which eliminates a weird "jitter" effect that sometimes occurred when using them.
2021-04-24 08:46:32 -04:00
.github/workflows Run prettier during CI. (#85) 2021-04-07 19:39:55 -04:00
.vscode Add .vscode dir. 2021-02-03 18:54:57 -05:00
assets Add files via upload 2021-04-23 20:51:35 -05:00
lib Always permalink to Mandalas. (#99) 2021-04-24 08:46:32 -04:00
vendor Always permalink to Mandalas. (#99) 2021-04-24 08:46:32 -04:00
.babelrc Always permalink to Mandalas. (#99) 2021-04-24 08:46:32 -04:00
.gitignore Always permalink to Mandalas. (#99) 2021-04-24 08:46:32 -04:00
.prettierignore Run prettier during CI. (#85) 2021-04-07 19:39:55 -04:00
README.md Run prettier during CI. (#85) 2021-04-07 19:39:55 -04:00
build-avro-typescript.js Always permalink to Mandalas. (#99) 2021-04-24 08:46:32 -04:00
build-vocabulary.js Always permalink to Mandalas. (#99) 2021-04-24 08:46:32 -04:00
circle_spiral.toml Add files via upload 2021-04-05 12:02:25 -05:00
copy-svgs-from-dropbox.sh Add copy-svgs-from-dropbox.sh. 2021-02-16 16:21:17 -05:00
globe.toml Add files via upload 2021-04-05 17:09:25 -05:00
index.html Always permalink to Mandalas. (#99) 2021-04-24 08:46:32 -04:00
package-lock.json Always permalink to Mandalas. (#99) 2021-04-24 08:46:32 -04:00
package.json Always permalink to Mandalas. (#99) 2021-04-24 08:46:32 -04:00
skeleton.svg Add files via upload 2021-04-05 16:27:19 -05:00
tsconfig.json Always permalink to Mandalas. (#99) 2021-04-24 08:46:32 -04:00

README.md

This is an attempt by Nina Paley (art) and Atul Varma (code) to tinker with procedural art.

Right now there is no particular goal other than to explore various ideas. The project consists of a web site with multiple pages, each of which is an experiment of some kind.

It can be viewed online or iterated on locally using the instructions below.

Quick start

This requires NodeJS. It was started with NodeJS 14.15.4, but hopefully it should work with any recent version.

After cloning the repository and entering it, run:

npm run watch

then visit http://localhost:1234.

Running tests

To run tests interactively, run:

npm run test:watch

Code style

All code styling is managed by Prettier.

To format the code automatically, run:

npm run prettier:fix

You can alternatively install a Prettier extension for your editor; see its website for more details.

Deployment

To deploy the project to GitHub Pages, run:

npm run deploy