Wykres commitów

129 Commity (a5c4bd737bbd48ac40f4afcdcff6c2848068ee11)

Autor SHA1 Wiadomość Data
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 d73116509c
Move SVG vocabulary from JSON to TS. (#59)
Ugh, we need to write out a TypeScript file instead of importing the JSON directly because otherwise the TS compiler will spend an inordinate amount of time doing type inference, which massively slows down type-checking (especially in IDEs and such).

The TS file actually uses `JSON.parse` on a stringified version of the JSON instead of just inlining the JSON itself because [apparently it's much faster][1].

[1]: https://www.bram.us/2019/11/25/faster-javascript-apps-with-json-parse/
2021-03-27 16:00:20 -04:00
Atul Varma 3095e5b16a Add randomize button to mandala page. 2021-03-27 15:19:36 -04:00
Atul Varma 9ce2d8df80 Factor out NumericRange type, inclusiveRange(). 2021-03-27 15:01:58 -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 e69ce202da Oops, rename 'data' to 'assets' (#47). 2021-03-22 23:00:04 -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 233dbc379d
Move SVGs into data/symbols. (#54)
This fixes #47 by moving the SVGs into `data/symbols`.
2021-03-22 20:30:36 -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 cb55b12243 Maintain inversion of nested symbols. Fixes #39. 2021-03-07 19:40:30 -05: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
Atul Varma 5cf9408f55 Ignore empty groups in SVGs. Fixes #42. 2021-03-03 20:08:43 -05:00
Atul Varma 6ce30b15f6 Ignore spec colors we don't recognize. 2021-03-03 19:50:23 -05:00
Atul Varma 1824d7249b Add stroke/fill swap button. 2021-02-28 20:11:50 -05:00
Atul Varma 82f8972662 Always try to nest symbol in the center. Fixes #38. 2021-02-28 19:49:41 -05:00
Atul Varma b1b0176e4a Add support for never_be_nested metadata. 2021-02-28 19:10:53 -05:00
Atul Varma c62214186b Only log warnings for unrecognized metadata properties. 2021-02-28 18:57:51 -05:00
Atul Varma 80d8f5f72a
Massively refactor and simplify creature-symbol.tsx. (#37)
This refactors `creature-symbol.tsx` so that it doesn't have to rely on awkwardly introspecting `JSX.Element` instances to do its job.  Now all of that mumbo-jumbo, which is only really useful for when we want to manually construct symbols like the eye creature, is encapsulated in `creature-symbol-factory.tsx`.
2021-02-27 18:55:14 -05: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 c803c41bd0
Add support for nesting in random creature generation. (#34)
This builds upon #30 and #33 by adding support for randomly nested symbols in complexity levels 0-4 of the creature page.

Currently, we don't _recursively_ nest symbols, so e.g. we won't make an eye containing an eye containing a cube.  And for now we'll only add a nested symbol if the parent symbol has the `always_nest` metadata property defined.
2021-02-27 10:02:07 -05:00
Atul Varma 40d6120d5b Reorder code to make more sense. 2021-02-27 09:22:07 -05:00
Atul Varma 3ad6dd290f Add some doc comments. 2021-02-27 09:21:11 -05:00
Atul Varma 5a5030ceb6 Make creature error messages easier to read. 2021-02-27 09:00:18 -05:00
Atul Varma 87affa0a4c Move constant to top of file. 2021-02-27 08:51:42 -05:00
Atul Varma 4098a23482 Factor out creature-symbol.tsx. 2021-02-27 08:50:06 -05:00
Atul Varma 9a014dba56 Factor out export-svg.tsx. 2021-02-27 08:43:31 -05:00
Atul Varma 327f99fdae Factor out auto-sizing-svg.tsx. 2021-02-27 08:35:34 -05:00
Atul Varma 3e1b66a984
Add support for TOML symbol metadata. (#33)
This fixes #20 by adding support for TOML-based metadata for symbols.

There's now a template TOML file in `svg/_template.toml` that documents all the different metadata properties.  The file can be copied to match the name of an SVG file (but with a `.toml` extension) and it will be processed by the vocabulary builder when the site is generated.

Currently there are only two properties documented, `always_nest` and `always_be_nested` (as per the needs outlined in https://github.com/toolness/mystic-symbolic/issues/17#issuecomment-786696966), but they don't actually do anything yet (actual support for _using_ the metadata will come in another file).

Right now the TOML files are validated quite stringently: if a file contains the name of a property it doesn't understand, or the type of the property is wrong, it will raise an error. We can revisit this if it becomes burdensome.
2021-02-26 21:30:38 -05:00
Atul Varma 520ea6aff4
Add basic support for nesting. (#30)
This adds basic support for nesting (#17).  It does not swap fill/stroke colors based on the position of the nesting box, though. It also only nests a symbol in the eye creature and "bonkers" complexity setting for now--support for nesting in complexity levels 1-4 is forthcoming.

The nested symbol is essentially uniformly scaled as much as possible without extending outside the boundaries of its parent's nesting box.
2021-02-25 21:57:10 -05:00
Atul Varma 524288db91 Set default background color to #858585. Fixes #12. 2021-02-25 19:40:18 -05:00
Atul Varma f1bfc59c79 Don't attach things to anchor points. Fixes #29. 2021-02-23 11:46:00 -05:00
Atul Varma 154f1fe61a
Add multiple complexity levels for creature generation. (#28)
Fixes #18 by adding a random creature complexity slider. Currently slider values are 0, 1, 2, 3, 4, and bonkers.
2021-02-22 21:50:14 -05:00
Atul Varma 0125710064
Add anchor attachment point type. (#23)
This fixes #21 by changing the existing "tail" attachment point (`#ff0000`) to be called the "anchor" attachment point, since that's primarily what we're using it for.  It also adds a brand-new "tail" attachment point with color `#be0027`, which is expected to be oriented in the direction the tail should point (not the _opposite_ direction of the tail, which is how the old tail attachment point was oriented).

Note that this change means, for now, that no symbols have tail attachment points.  An error will be logged in the console when viewing the "Creature!" page for now because of this (since the default composition attaches a symbol to the tail), but as soon as Nina updates the SVGs, this should go away.
2021-02-21 21:13:14 -05:00
Atul Varma 7322740b14 Factor out convertSvgMarkupToSymbolData(), add test. 2021-02-21 20:54:36 -05:00