GoogleChromeLabs / houdini.how

A community-driven gathering place for CSS Houdini worklets and resources.
https://houdini.how
Apache License 2.0
152 stars 39 forks source link

Add Fractals Demo #135

Closed ConradSollitt closed 3 years ago

ConradSollitt commented 3 years ago

Here is the working demo (repository link is on the page): https://conradsollitt.github.io/css-houdini-fractals/

Since fractals use recursive functions I have a safety check in place and use reasonable defaults to avoid long delays. One the demo there is a variable that allows for CSS output to the console so you can see how many functions were called and how fast it runs on your machine.

Tested browsers:

For my demo I need to improve the layout for mobile browsers (likely tomorrow or later this week).

Also the current defaults may need to be adjusted for smaller size or based on need for better performance on initial page load. Here is a quick test of 240x240px using defaults that result in much less rendering and render in milliseconds. The defaults I specified can take about 20 milliseconds which may or may not be acceptable for the initial page load.

image

Tomorrow (actually later today - it's 2:20 AM where I live in Los Angeles 🤦‍♂️) I'm happy to help make any additional changes needed or help with more test. Or whatever time works!

Awesome site by the way!!! I have read about CSS Houdini before but wasn't sure if it was something I would ever use but after seeing https://houdini.how/ I think there is a lot of great use and options for it.

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

ConradSollitt commented 3 years ago

@googlebot I signed it!

ConradSollitt commented 3 years ago

After playing around with the demo some more I think changing the --max-draw-count from 100,000 to 10,000 (commas here for clarity) would be a good idea. It keeps the rendering much more performant when using the range controls and if the user generates large fractals it provides an interesting effect by default as half the screen can be drawn and rotate as the user drags the angle.

ConradSollitt commented 3 years ago

Thanks @nucliweb

ConradSollitt commented 3 years ago

Two minor issues I found when testing the site locally:

I'm not sure if I can update the pull request for it or if I should wait till after this one is merged (to avoid issues I feel like I should wait). Basically I'll remove some 1 color on the default list a a few from the gray scale list and then --colors can fit to visually like up with all other items.

As I mentioned before I'll revise down the default available value for --max-draw-count and I also think it makes since to limit the range to 50_000 and use step of 1000 but I can make that later as well.

Noice on the screenshot below the input for --max-draw-count is wider than other numeric inputs.

image

I was able to do that through CSS alone, however it requires a known attribute value. Would this update (highlighted code below) be acceptable if I were to submit a pull request for it?

Although it would be specific to my worklet it could be easily tweaked for future worklets if any use large numbers. I am not aware of any CSS that would let me calculate the number of characters to determine what the input length should be and making the change in CSS avoids adding extra props to JSON and JSX code.

image

una commented 3 years ago

Thanks, I'll take a look at the CSS to avoid hiding this number. VERY cool worklet!

ConradSollitt commented 3 years ago

@una I just made the updates on this pull request and when I click the Files changed tab the fractals.json file look good.

The update points to the 1.1.0 release rather than 1.0.0 and it includes the new --shapes property I wrote about in my earlier comment. Rather than pointing the CDN link to always use the latest I point it a specific version just in case I decide to make updates one day then nothing would break on https://houdini.how/ because it will point to the correct version for the variables.

image

ConradSollitt commented 3 years ago

@una Unrelated to this but I just realized right now when I was updated my personal site earlier this year (link below) one of the things that helped me come up with a nice Text Effect for the <h1> header was one of your articles (link also below). I listed 7 helpful links in the CSS comments and put your's first. So great job on your site because I found the content to be of top quality and found I could to learn from and get ideas from as well. 😄

My personal site - one page https://conradsollitt.com/ When I submitted on awwwards I got 4 perfect 10's, many high 9's and my highest score overall compared to past sites. I think in part because of the text effect. Also got a 5 and 6 score so can't win everyone.

Your great Dynamic Color Article https://una.im/css-color-theming/

una commented 3 years ago

Thank you Conrad!