Wykres commitów

158 Commity (d19efc3a964ea5e9d5e585b5de0762e2c3ce6791)

Autor SHA1 Wiadomość Data
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
Atul Varma 5c903c0794 Allow stroke width to go to 0. Fixes #14. 2021-02-20 11:41:41 -05:00
Atul Varma 6f71305dd2
Add configurable bg color to creature page. (#19)
This fixes #12 by adding a background color picker to the creature page.

The default background color is `#cccccc`, which I _think_ is mid-gray.
2021-02-20 11:38:04 -05:00
Atul Varma 5c97a0e646 Set keyboard shortcut for randomize button (#13). 2021-02-20 11:07:57 -05:00
Atul Varma 19ead8b833 Deal gracefully w/ symbols that lack attachment points. 2021-02-18 22:25:11 -05:00
Atul Varma e89d613b38 Add a stroke width slider. 2021-02-18 22:13:01 -05:00
Nina Paley 4dafa463ec
Change "muscle arm" to "muscle_arm" in creature-page.tsx (#9) 2021-02-18 20:06:41 -05:00
Atul Varma f79214dfbb Work around unsupported transform-origin on Safari. 2021-02-17 12:37:24 -05:00
Atul Varma 3d04bdcd82 Group 'Export SVG' button with other buttons. 2021-02-17 09:14:06 -05:00
Atul Varma 68f5339e5f Add 'Export SVG' button. 2021-02-17 08:46:30 -05:00
Atul Varma 9d47ddf1b2 Add reset button. 2021-02-17 08:10:20 -05:00
Atul Varma b81f11fe76 Factor out SymbolContextWidget, use it on creature page. 2021-02-17 08:07:04 -05:00
Atul Varma 93225e9b6c Add more docs to readme, link to github repo in website. 2021-02-17 07:41:26 -05:00
Atul Varma 75c68bb1fb Use uniform, non-scaling-stroke. 2021-02-17 07:29:56 -05:00
Atul Varma f64c600825 Factor out <AutoSizingSvg>. 2021-02-16 20:54:05 -05:00
Atul Varma 6502d09177 Auto-resize SVG as needed. 2021-02-16 20:47:12 -05:00
Atul Varma 10341598ea Randomly replace creature parts. 2021-02-16 17:42:19 -05:00
Atul Varma 7db7c74516 Add left/right booleans to CreatureSymbolProps. 2021-02-16 17:11:41 -05:00
Atul Varma b2c073fa7c Factor out AttachmentTransform component. 2021-02-16 16:43:47 -05:00
Atul Varma d663915f0e
Make creature strokes non-scaling. (#6)
This attempts to manually scale the strokes on creatures so they aren't affected by scale.

The weird thing here is that applying `vector-effect="non-scaling-stroke"` does not appear to do the trick--rather, it makes all the strokes look _super heavy_.  So in this PR we scale the stroke by the inverse of whatever we're cumulatively scaling by when we're drawing something.
2021-02-16 13:36:14 -05:00
Atul Varma 2b27ae02a4
Fix math-related bugs in attachment code. (#5)
This fixes a bunch of bugs in our attachment-related code, and in so doing refactors things to make more sense, adds more tests, and also adds documentation.
2021-02-16 11:52:52 -05:00
Atul Varma 9ac1243249 Oops, fix type error. 2021-02-16 07:17:40 -05:00
Atul Varma aa87e3b77e Sort attachment points top to bottom, left to right. 2021-02-16 07:04:16 -05:00
Atul Varma cbf57f7fef Add more tests. 2021-02-16 06:49:45 -05:00
Atul Varma 6dfa738548 Add test suite. 2021-02-16 06:21:51 -05:00
Atul Varma 5f237b52bb Add legs. 2021-02-15 22:51:35 -05:00
Atul Varma 93e972256c Add 'show specs' checkbox on creature page. 2021-02-15 22:36:18 -05:00
Atul Varma a44c43a04e Make spec slightly transparent. 2021-02-15 20:34:49 -05:00
Atul Varma baf1f379b8 Add more stuff to creature. 2021-02-15 20:20:41 -05:00
Atul Varma b3402a2992 Take into account rotation of tail/anchor point. 2021-02-15 20:12:14 -05:00
Atul Varma f1207e5d9d Add basic rotations, fix z-indexing. 2021-02-15 19:28:03 -05:00
Atul Varma 31fcbeaf89 Adjust scaling and such. 2021-02-15 17:22:59 -05:00
Atul Varma de57971921 Remove random part TODOs for now. 2021-02-15 17:20:05 -05:00
Atul Varma 3e225a09be Factor out CreatureContext and CreatureSymbol. 2021-02-15 17:19:07 -05:00
Atul Varma 61697d4552 Put hand on eye. 2021-02-15 16:40:47 -05:00
Atul Varma 36165f2892 Make all symbol names lowercase. 2021-02-15 12:39:22 -05:00
Atul Varma e736afc7be Rename vocabulary.ts to vocabulary-builder.ts. 2021-02-15 12:37:25 -05:00
Atul Varma 291c9d60fa Factor out svg-symbol.tsx, visible-specs.tsx. 2021-02-15 09:56:02 -05:00
Atul Varma 455fb4ee45 Fix react attribute warnings on waves page. 2021-02-15 09:14:17 -05:00
Atul Varma 11c27b905f Make attachment point code more DRY. 2021-02-15 09:13:00 -05:00
Atul Varma 2384d1eac3 Add a placeholder creature page. 2021-02-15 08:34:22 -05:00
Atul Varma f908ab253d Add a simple linear congruential PRNG. 2021-02-15 08:34:05 -05:00
Atul Varma 972cecb056 Factor out svg-vocabulary.ts, increase symbol padding. 2021-02-15 08:33:33 -05:00
Atul Varma 4334a3eb3c Enable stricter typescript checks, remove unused import. 2021-02-15 07:44:22 -05:00
Atul Varma 897448ee6e Use latest symbols. 2021-02-15 07:33:48 -05:00
Atul Varma aa47012d4b
Use arrows for attachment points instead of circles. (#3)
Here we attempt to use arrowhead symbols in SVGs to allow artists to specify the orientation of attached symbols, rather than attempting to auto-detect it via projecting the circles onto the shape and using the normal as we did in #2.

It seems like this logic is both much simpler and less error-prone, especially around corners.  It also gives artists much more control over the placement of attachments.

The one fragile aspect of the implementation is that we assume the first point of the arrow shape is its tip, and that the third point is its indented bottom.  This appears to be consistent across all of Nina's SVGs, so far at least...
2021-02-14 21:27:20 -05:00
Atul Varma a58ac3e5ff Add stroke/fill widgets. 2021-02-14 17:29:37 -05:00
Atul Varma bcd5390ca1 Tweak some stuff. 2021-02-14 17:19:01 -05:00
Atul Varma 01ee8068db Add some sliders. 2021-02-14 17:13:27 -05:00
Atul Varma 046c940351 Add waves. 2021-02-14 16:39:10 -05:00
Atul Varma 0652aa19ea Add rudimentary about page. 2021-02-14 12:32:55 -05:00
Atul Varma f3beb8cdd9
Auto-detect direction of normals. (#2)
This auto-detects the direction of normals on which to attach attachments.

Right now it's getting very confused by corners, but otherwise it seems to mostly work.
2021-02-14 12:07:34 -05:00
Atul Varma 6d911e1654 Use js-bezier's BBox struct and functions. 2021-02-14 07:44:52 -05:00
Atul Varma 2b0d69bb87 Factor out getColor(). 2021-02-14 07:32:54 -05:00
Atul Varma a135b6930b Add checkbox toggle to show specs. 2021-02-13 21:13:04 -05:00
Atul Varma f70cdbad8d Extract attachment points and nesting boxes. 2021-02-13 20:47:28 -05:00
Atul Varma 26d4c721cf Remove specs-related shapes. 2021-02-13 20:29:20 -05:00
Atul Varma 81a1e32b0f Split up paths w/ multiple shapes into multiple shapes. 2021-02-13 19:40:20 -05:00
Atul Varma 323eede18e Get rid of unused width/height attrs. 2021-02-13 19:26:07 -05:00
Atul Varma 56fd341daa Factor out colors.ts. 2021-02-13 19:24:46 -05:00
Atul Varma 27cbf37209 Detect bounding boxes of symbols and crop to them. 2021-02-13 09:02:25 -05:00
Atul Varma aa61f26c79 Rename to Mystic Symbolic. 2021-02-13 07:20:16 -05:00
Atul Varma ea1f42d810 Simplify stroke/fill logic. 2021-02-06 10:57:41 -05:00
Atul Varma b17f429ef8 Add checkerboard bg. 2021-02-06 08:11:20 -05:00
Atul Varma 1e3cbe73b1 Add support for shadows, bg color. 2021-02-06 08:02:18 -05:00
Atul Varma 5df222edea Process multiple children of <svg>, store SVG as struct. 2021-02-06 07:50:51 -05:00
Atul Varma d55c03fcc5 Use filename as name, not <g> id. 2021-02-03 20:29:42 -05:00
Atul Varma 63f3c2be88 Use one paragraph for stroke and fill 2021-02-03 20:26:17 -05:00
Atul Varma 2d1fb67839 Change styling a bit. 2021-02-03 20:23:24 -05:00
Atul Varma 65ad4aa96b Don't version built vocabulary. 2021-02-03 19:59:39 -05:00
Atul Varma 66fc1caaac don't replace fill/stroke of 'none'. 2021-02-03 19:58:25 -05:00
Atul Varma 511ea2510b Make stroke/fill configurable. 2021-02-03 19:53:01 -05:00