Wykres commitów

101 Commity (7412f7f775baeec8017e482862097898652dfba4)

Autor SHA1 Wiadomość Data
Atul Varma 8151663860
Add 'always include this symbol' dropdown. (#115)
Fixes #36.
2021-05-12 21:55:18 -04:00
Atul Varma addc6506fb
Include symbol names in mandala export filename. (#109)
This fixes #93 by making the exported mandala filenames include the names of the symbols used in them.  So for example, a mandala with circles made up of the `crown_ornate` symbol and the `heart_break` symbol will now have an exported GIF filename of `mandala-crown_ornate-heart_break.gif`.
2021-04-25 15:56:28 -04:00
Atul Varma c83c678be1 Add 'mask with circle' checkbox to waves page. 2021-04-24 14:28:20 -04:00
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
Corinna Cohn 54be581005
feature(mandala): add rotation syntax to toml and mandala animation (#103)
This adds a "rotate_clockwise" property to the TOML metadata, which allows the default direction of rotation to be changed on a per-symbol basis.

Co-authored-by: Corinna Cohn <corinna.cohn@gmail.com>
2021-04-22 20:53:18 -04:00
Atul Varma a64f649a3b Limit the randomized mandala radii to [100, 500]. Fixes #76. 2021-04-17 14:33:09 -04:00
Atul Varma 949d8d72dd
Allow user to choose from multiple palette algorithms. (#97)
Fixes #95.
2021-04-17 07:33:27 -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 7fc210f671
Add randomizer widget. (#87)
This replaces the "randomize colors" and "randomize" buttons on the creature and mandala pages with a single randomizer widget that allows the user to choose whether they want to randomize the colors, symbols, or both.

By default, both colors and symbols are randomized.

Note that this is really only a temporary solution, though: ideally we'll want to provide a more powerful UI that allows users to mark _any_ parameter for randomization, e.g. via "pinning" values or somesuch.
2021-04-08 20:13:54 -04:00
Atul Varma 25b708da47
Add random color sampling to debug page. (#86)
This adds a "random color sampling" section to the right side of the debug page.

I'm hoping this will make it easier for @mittimithai to work on his random color code, since it shows a bunch of random colors (100 right now) side-by-side, rather than requiring the developer to constantly click "randomize colors" on mandala/creature to get an idea of what the color spectrum looks like, 3 colors at a time.
2021-04-07 20:08:55 -04:00
Atul Varma 24eead10f8 Disable 'invert every other symbol' if needed. 2021-04-04 08:46:09 -04:00
Atul Varma dc13207b4d
Make animation duration changeable (#77)
This adds a slider that allows the duration of the mandala animation to be changed (for #71).

In so doing, it also decouples the animation speed from the display's refresh rate.
2021-04-04 08:34:29 -04:00
Atul Varma 2ce4f8a602 Factor out mandala-circle.tsx. 2021-04-03 18:47:43 -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 8be5792838 Make mandala the default page. 2021-04-02 19:02:40 -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 7c05f78fd9 Only allow 20 max symbols in mandala. Fixes #69. 2021-04-02 15:37:58 -04:00
Atul Varma 2c53e5caab
Add a 'randomize colors' button to mandala and creature pages. (#68)
The random colors are currently terrible!  Maneesh will help us make them better. :)

Also, there is some annoying code duplication going on here between the creature and mandala pages, but I really wanted to add the button to both and also want to eat dinner soon, so I am filing #67 and saving the refactoring for later.
2021-03-30 20:59:45 -04:00
Atul Varma 5e74ce34ea
In mandala, add checkbox to invert every other symbol. (#66)
Fixes #64.
2021-03-29 15:23:37 -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 f6c95f1ffb Don't fill if showing specs on mandala. 2021-03-29 08:23:53 -04:00
Atul Varma 9aa0c6118f Add a search field in vocabulary page. 2021-03-29 07:58:50 -04:00
Atul Varma 3090d9fd89
Add an 'Export PNG' button (#63)
This fixes #62.
2021-03-29 07:22:09 -04:00
Atul Varma 85533fa111 Use an eye w/ radius 300 for default mandala. 2021-03-29 06:54:36 -04:00
Atul Varma a70b4dfab3 Add a 'place behind first circle' checkbox. 2021-03-28 16:49:38 -04:00
Atul Varma b70ec50e3a Add symbol scaling/rotation options. 2021-03-28 16:22:36 -04:00
Atul Varma 05c44eeb51 Make scaling and rotation adjustable on both circles. 2021-03-28 09:14:54 -04:00
Atul Varma a5c4bd737b Put first mandala symbol at front of z-order. 2021-03-28 08:50:04 -04:00
Atul Varma 50eeb9a25b Always have a symbol pointing up in mandala. Allow negative radius. 2021-03-28 08:48:36 -04:00
Atul Varma d742f4156a Add an optional second mandala circle (#24). 2021-03-28 08:27:57 -04:00
Atul Varma c76bcc2d5a Factor out checkbox.tsx. 2021-03-28 07:38:32 -04:00
Atul Varma 131c1f31cb
Orient mandala symbols around their anchor point. (#60)
This orients the mandala symbols around their anchor point, rather than the center of their bounding box (#24).
2021-03-28 07:24:16 -04:00
Atul Varma 6fa6e0ba8a Simplify getDownloadFilename(). 2021-03-28 06:48:29 -04:00
Atul Varma 3f366c112a Rename SvgTransforms to SvgTransform, allow it to take a single transform. 2021-03-28 06:39:06 -04:00
Atul Varma 3095e5b16a Add randomize button to mandala page. 2021-03-27 15:19:36 -04:00
Atul Varma 7cb4c3242d get rid of ValidateDOMNesting warnings 2021-03-27 08:34:22 -04:00
Atul Varma 51f68656ad Factor out vocabulary.ts. 2021-03-27 08:29:42 -04:00
Atul Varma a19a560b8f Auto-generate id attributes by default. 2021-03-27 08:11:07 -04:00
Atul Varma 4bd30bb2a5 Add SVG symbol widget picker to mandala page. 2021-03-27 08:04:40 -04:00
Atul Varma 249e5df219 Add more sliders, export svg btn to mandala page. 2021-03-27 07:39:21 -04:00
Atul Varma fbca3b65ba Factor out numeric-slider.tsx. 2021-03-27 07:24:15 -04:00
Atul Varma c7d1092cda Factor out ColorWidget component. 2021-03-27 07:14:42 -04:00
Atul Varma 8a54b62bdb
Move eye creature to a separate debug page. (#58)
Really the eye creature is only useful for me as a debugging tool, so this moves it over to a separate debug page.

It also removes the whole concept of randomizing the eye creature, mainly because it ignores all the rules set forth in the normal creature randomizer, so it's not terribly useful.

This simplifies the code for `creature-page.tsx` a bunch and hopefully makes it easier to understand.
2021-03-26 20:47:22 -04:00
Atul Varma 13907a7851 Use SvgTransforms in creature page. 2021-03-26 20:09:17 -04:00
Atul Varma f790838b06
Add a very basic Mandala page. (#57)
This adds an extremely simple Mandala page (for #24) with a single circle Mandala comprised of several eyes.  The symbol style is configurable, but parameters for the actual Mandala are not (yet).

Doing this also involved factoring out a `<SvgTransforms>` component, which makes setting up SVG transforms a bit easier.

Also moved `getSymbol` of `creature-page.tsx` and into `svg-vocabulary.tsx`, with the new name `getSvgSymbol`.
2021-03-26 18:07:01 -04:00
Atul Varma 059c0528c7
Default complexity level to 2. (#55)
This fixes #53.  Note that this means the eye creature isn't observable from the UI, as moving the slider to "bonkers" shows the eye with parts randomly replaced.  The "pristine" eye creature can still be shown for debugging purposes by adding `&eye=on` to the end of the URL.
2021-03-22 20:54:01 -04:00
Atul Varma 612195e2f2
Add attach_to metadata. (#52)
This fixes #49 by implementing the `attach_to` metadata property.
2021-03-18 19:32:05 -04:00
Atul Varma 1405810526
Add checkbox for randomly inverting some symbols. (#43)
This fixes #39 by adding a "Randomly invert symbols" checkbox.

If the inversion is undesirable, disabling it will keep the existing creature but remove the inversion.

Note that this checkbox is only displayed when the creature complexity isn't bonkers.
2021-03-06 20:35:58 -05:00
Atul Varma ecf98deedb Add support for invert_nested (#17). 2021-03-05 19:38:25 -05:00