Wykres commitów

205 Commity (f16f6ff5763f646f141e0a5247792cc98636ddcb)

Autor SHA1 Wiadomość Data
Atul Varma cc6b376c35 Add some docs. 2021-08-22 12:08:38 -04:00
Atul Varma f7d3475cd2 Refresh gallery less aggressively. 2021-08-22 12:01:30 -04:00
Atul Varma 3668d078ee Link to compositions. 2021-08-22 10:23:09 -04:00
Atul Varma b0802f82ba Add terrible gallery page. 2021-08-22 10:10:31 -04:00
Atul Varma 22ae85c512
Factor out firebase.tsx, FirebaseAppContext (#216)
This factors out a ` firebase.tsx` file and a `FirebaseAppContext` in preparation for gallery work (#26).
2021-08-22 09:10:17 -04:00
Atul Varma bec2c4eb49 Allow firebase actions to be retried on error. 2021-08-22 08:27:49 -04:00
Atul Varma f927db60c0
Add Firebase-powered GitHub login (#215)
This adds GitHub login via Firebase, as a foundation for adding a gallery (#26).  Currently it just adds a login/logout button to the Debug page.

At an architectural level, this adds an `AuthContext` React context, whose interface is generic enough that it's not coupled to Firebase or GitHub.  In fact, the default context is a "null context" whose operations are all no-ops.
2021-08-21 19:43:47 -04:00
Atul Varma ed23d0ac3b Move complexity, invert symbols into randomizer widget. 2021-08-15 15:49:28 -04:00
Atul Varma ebd8ad0493
Add useRememberedState(). (#212)
This adds a new `useRememberedState()` React hook that effectively allows us to have user interface elements that "remember" their most recent value, even if the UI itself was unmounted at some point.  (It only works for the lifetime of the page, however, so it doesn't remember values across page reloads; this is intentional, as I didn't want to have to worry about serialization or schema migration.)

The hook is now used in the randomizer widget and for some of the creature page widgets, to ensure that their settings are preserved more often than not.
2021-08-15 15:44:54 -04:00
Atul Varma beb12345a1
Implement new Avro schema for creatures (#211)
The creature state stored in #210, while quite compact, is also very fragile, because any minor change in our creature generation algorithm or even vocabulary will completely throw off existing serializations.

This attempts to serialize the actual _creature_ created by the generator rather than its random number seed, which will be a larger serialization but also one that is more resilient to future changes in the algorithm and/or vocabulary.  It should also pave the way for tweaking generated creatures.

Note that the previous `v1` schema implemented in #210 is no longer supported--i.e., links that use it will now be broken.  Hopefully this is OK because it hasn't been around for very long, but it was just way too much work to migrate that schema to the new `v2` format.
2021-08-15 14:41:05 -04:00
Atul Varma 77496c6301
Store creature state in querystring (#210)
This is an attempt to help with #61 by storing the creature state in the querystring.

However, a crucial issue with this implementation as it stands is that it stores the random number seed used to generate the creature.  This is great for representing the state in a compact form, but it's also likely to break easily as the vocabulary and randomization algorithm changes.

So, in the future, we might want to represent the creature state by enumerating the actual structure of the creature, which is likely to be a bit more future-proof.  (It also makes it possible for us to add features in the future that allow users to tweak the randomly-generated creature.)

But for now at least, this will allow users to use the back and forward buttons in their browser to navigate between creatures, so that if they click randomize and skip past something that looked cool, it's easy to go back and visit it.
2021-07-24 14:00:42 -04:00
Atul Varma 59cd1d1915 Hover helper tooltips aren't obscured by cursor. 2021-07-18 16:52:18 -04:00
Atul Varma e4b401f97f
Add a 'creature_frequency_multiplier' TOML property. (#207)
Fixes #191.

Currently the implementation is fairly naive, in that a really large value for `creature_frequency_multiplier` will not be handled terribly efficiently, but we can optimize later if needed.
2021-07-17 14:39:19 -04:00
Atul Varma 34fb3080fa Enable gradients, set colors to randhue. Fixes #209. 2021-07-17 14:03:04 -04:00
Atul Varma ea7673f70e
Split up CSS into multiple files and use CSS imports (#206)
This splits up our `styles.css` file into multiple CSS files that sit alongside the TSX files that use their classes.  All "generic" CSS that isn't used by any one particular component, such as our `thingy` class, is currently being put into `page.css`.

The CSS files are imported via `import` statements in their associated TSX files. As such, this fixes #164.

This also starts formatting our CSS using Prettier.

It also moves some of our `<head>` tags back into `index.html`, reverting a tiny bit of #205, to ensure that some of the metadata can be recognized by browsers, and start loading asynchronously, independently of the page's JavaScript (I see no reason why any of those elements need to change dynamically based on the app's state, so there don't seem to be any downsides to this).
2021-07-11 15:59:37 -04:00
Webaissance 86a39b56e0
#56 Add logo and favicon (#205)
This does the following:
* Adds logo
* Adds favicon
* Creates css directory in dist
* Creates img directory in dist
* Updates /lib/page.tsx to use helmet to incporate the logo, favicon and style.css file
* adds a new file .gitattributes to make Windows use Linux line endings per https://prettier.io/docs/en/options.html

Co-authored-by: Webaissance <git@webais.com>
2021-07-11 12:04:10 -04:00
Atul Varma 9a80ead5b7
Add never_flip_attachments to TOML metadata. (#203)
This adds a new `never_flip_attachments` property to TOML metadata, as discussed in #184, and sets it to `true` for the `face_nest` symbol.
2021-07-05 19:35:39 -04:00
Atul Varma 7d53e97262
Add a 'wildcard' (neutral) attachment point type. (#200)
This adds a new attachment point type called `wildcard` (colored `#000000` in the SVGs) which, as the name suggests, can contain _any_ kind of symbol.

Fixes #187.
2021-07-05 06:30:05 -04:00
Atul Varma f7bc1bdc56
Add some hills to the waves page. (#177)
This minimally fixes #143 by adding optional hills to the waves page (they default to being disabled but can be enabled via a checkbox).  It also adds haze to the waves, so that they are blended with the color of the sky as they recede into the distance.
2021-07-04 16:34:17 -04:00
mittimithai 303bc6b543
randHue color algorithm (#194)
Added new color algo, cleaned up random-colors a bit.
2021-07-03 09:34:30 -04:00
Atul Varma 56edab5369 Factor out parseHexColor(). 2021-06-27 09:19:18 -04:00
Atul Varma 1c5e918d89 Add donate link. Fixes #162. 2021-06-10 14:26:49 -07:00
Atul Varma 7af19de6c0
Actually check TSX files with Prettier. (#159)
This makes us actually check TSX files with Prettier (until now we were only checking TS files).

It also re-runs Prettier, although apparently it fixes something in a TS file that was raising a warning, which I find very odd--since TS files were already being checked, I'm not sure how we didn't have a broken build...
2021-06-08 12:40:41 -04:00
Atul Varma b68bc9726f
Require that main body of creature have at least 1 attachment point. (#154)
This fixes #45.
2021-06-07 08:01:11 -04:00
Atul Varma 1ff17b96c1 Link to Nina's blog in the footer. 2021-06-07 07:39:52 -04:00
Atul Varma 79c0ca6924 Disable gradients by default. Fixes #150. 2021-06-06 19:39:42 -04:00
Atul Varma c4cf38f1d4 Change default page to 'creature'. Fixes #149. 2021-06-06 19:37:35 -04:00
Atul Varma d725e6622c Add comment linking to #140. 2021-06-06 17:53:43 -04:00
Atul Varma 045e96d34d
Add a 'disable gradients' toggle. (#148)
This adds a toggle to disable gradients, fixing #140.

On the Mandala page, this changes how our permalinks are structured, but does so in a backwards-compatible way, thanks to [Avro schema evolution][1].  Now the `s` querystring argument is prefixed with a schema version, the latest being `v2`.  If this prefix is missing, it's assumed to be the very first schema version, `v1`, and interpreted accordingly.

[1]: https://martin.kleppmann.com/2012/12/05/schema-evolution-in-avro-protocol-buffers-thrift.html
2021-06-06 17:49:49 -04:00
Atul Varma 2f82e2dc31
Set page <title> to same value as <h1> (#147)
Fixes #142.
2021-06-06 09:37:45 -04:00
Atul Varma cfa414d74c
Add support for linear gradients (#135)
Fixes #134.
2021-05-28 12:41:25 -04:00
Atul Varma 46d9f524da
Use eslint. (#133)
Fixes #128.

A number of hook-related warnings were brought up, which this PR also fixes.  Note that from now on, if there are any warnings raised by the eslint, CI will fail.
2021-05-28 10:17:45 -04:00
Atul Varma d13c892f3d
Use esbuild instead of Parcel. (#131)
This replaces Parcel with [esbuild][].

esbuild has a number of advantages over Parcel:

* It is much, much, *much* faster. A Parcel build takes several seconds on my system, while esbuild takes 60-70 _milliseconds_.
* Parcel hard-crashes when I switch branches on Windows, esbuild doesn't.

The one disadvantage is that, as far as I can tell, esbuild doesn't support any kind of auto-reloading in the browser when you change things. IMO this isn't that big a deal and the benefits outweigh this minor inconvenience (and anyways, auto-reload has historically backfired so many times that I usually have been manually reloading the page whenever I make changes).

[esbuild]: https://esbuild.github.io/
2021-05-28 07:34:17 -04:00
Atul Varma f3ab28f70d
Factor out color-util.ts. (#130)
This fixes #129 and also factors out a new function, `clampedBytesToRGBColor()`.
2021-05-28 06:13:19 -04:00
Atul Varma 902dfa23fa
Add support for gradients (#127)
Fixes #121.
2021-05-27 16:09:05 -04:00
mittimithai 55e70a44b3
Small adjustments to color sampling per meeting, commented out old ones (#122) 2021-05-19 06:31:30 -04:00
mittimithai d6303dfa6f
Small bug in color generation fixed (#120) 2021-05-18 18:30:54 -04:00
mittimithai 7edef5920f
Multiple color functions (#119)
Based on spec from meeting. Start at a random hue h1, functions specify increment to h2 and then h3 is (h1+180).
2021-05-15 06:41:11 -04:00
Atul Varma 8151663860
Add 'always include this symbol' dropdown. (#115)
Fixes #36.
2021-05-12 21:55:18 -04:00
mittimithai 7003daeebf
Baseline color rules working (#111)
Made the new rule the default, but its now easy to play with to adjust the exact color rule we are using. This new one pick 3 values (with a bit of randomness), picks a random hue (then picks 2 more with a small chance of taking the opposite hue), and picks a saturation level that tends to be high.
2021-04-30 07:15:38 -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 72354e65a0
Scale animated GIFs by 50%. (#108)
This halves the dimensions of animated GIF exports, which fixes #104.
2021-04-25 15:27:18 -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
mittimithai bdc96e8c5a
introduced Interval in random.ts (#91)
This adds a new `Random.inInterval()` method and uses it.
2021-04-13 15:41:47 -04:00
mittimithai 296397c4ae
color sampling fixes (#88)
Fix random color sampling to be more awesome.
2021-04-11 14:51: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