Wykres commitów

18 Commity (f49fa7170d089091ebb3af29e57517d02881e972)

Autor SHA1 Wiadomość Data
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
Atul Varma bca699018c
Add animated GIF export. (#79)
This adds an "Export GIF" button _if and only if_ animation is enabled on the Mandala page.

The GIF has the same dimensions as the canvas at the time that the button was clicked.

Currently the animation is locked to 15 FPS, which I think might be the maximum rate that some platforms limit it to, but I'm not sure.  We can always adjust it in the future.
2021-04-10 17:11:12 -04:00
Atul Varma 6136253cd6
Add basic animation support to the mandala page (#75)
This addresses part of #71 by adding some basic animation support to the mandala page.
2021-04-03 17:01:13 -04:00
Atul Varma 1cbe2b6d22
Improve layout (#74)
This improves the layout of all our pages to look more like the mandala page.

Additionally, some form widgets now have better layout, and the header takes up less vertical space.

At an implementation level, the component hierarchy of pages has been inverted to make this kind of layout easier.  Now fully laid-out pages are contained within `<Page>` components that are at the top of the component hierarchy, and which are defined by each specific page (mandala, creature, vocabulary, etc).

I had to do a few architectural things to avoid circular imports, though; most notably, this involved the creation of a new React context called a `PageContext`.

It uses CSS grid, which should be pretty well-supported amongst recent browsers.
2021-04-02 19:00:29 -04:00
Atul Varma e48b5f9bae
Factor out a SvgCompositionContext. (#72)
This fixes #67 by making the background color selection/randomization code more DRY via the addition of a new `SvgCompositionContext` and a `CompositionContextWidget`.

It also documents the `SvgSymbolContext` type, and moves the "randomize colors" button closer to the actual colors.
2021-04-02 16:33:07 -04:00
Atul Varma 63e9101d42
Make mandala UI layout a bit less terrible (#65)
The key phrase here is **less terrible**, as opposed to **good**.

Right now if the mandala gets too big for the page, it will just overflow and the remainder won't be visible (not even via scrolling).  This is intentional, though, as per @ninapaley's suggestion:

> I'm hoping you can change the way the image keeps resizing its canvas, and keeps justifying left.
> Maybe have an oversize canvas with the ring pinned to the center, and all the adjustment sliders
> on the right? Then they won't disappear if the canvas is too big. Also! I have an idea for an
> animated cycle that would require the symbols to eventually outgrow the canvas area and disappear.

I'm not super happy with this CSS, it doesn't feel terribly maintainable.  Ah well, maybe we can improve it later.
2021-03-29 13:03:54 -04:00
Atul Varma 9aa0c6118f Add a search field in vocabulary page. 2021-03-29 07:58:50 -04:00
Atul Varma a917f40da9 Move page list to header for easier navigation. 2021-03-29 07:48:56 -04:00
Atul Varma 7cb4c3242d get rid of ValidateDOMNesting warnings 2021-03-27 08:34:22 -04:00
Atul Varma 4bd30bb2a5 Add SVG symbol widget picker to mandala page. 2021-03-27 08:04:40 -04:00
Atul Varma 6aba6b665f
Add mouseover tooltips with debugging information (#35)
This adds a bit of debugging information on mouseover.

For example, a tooltip with the text `bird@tail.arm[0]` can be interpreted as "a bird symbol attached to the tail symbol's first arm attachment point."

The implementation is a bit funky: we basically annotate the SVG DOM with various `data` attributes, and on mouseover we traverse the DOM from the element the mouse is over all the way up to the SVG root element, picking out relevant `data` attributes and building a tooltip out of it.  This ended up being easier than e.g. passing a bunch of props down the whole tree in React.
2021-02-27 13:28:44 -05:00
Atul Varma aa61f26c79 Rename to Mystic Symbolic. 2021-02-13 07:20:16 -05:00
Atul Varma 026b02ef7f Add link to codepen. 2021-02-06 08:13:56 -05:00
Atul Varma b17f429ef8 Add checkerboard bg. 2021-02-06 08:11:20 -05:00
Atul Varma 2d1fb67839 Change styling a bit. 2021-02-03 20:23:24 -05:00
Atul Varma f0960d4280 use react. 2021-02-03 19:11:34 -05:00
Atul Varma a4a1013a8c Add more stuff. 2021-02-02 20:09:49 -05:00
Atul Varma 1a4c8adc41 Origination. 2021-02-02 19:26:40 -05:00