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

Added quadratic bezier curve demo #151

Open gnikoloff opened 3 years ago

gnikoloff commented 3 years ago

Description

Added a new demo that renders continuous quadratic curve through multiple points.

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.

gnikoloff commented 3 years ago

@googlebot I signed it!

una commented 3 years ago

Wow this is so cool! Is there any way to set the points instead of them being randomized? That feels super helpful for charting

gnikoloff commented 3 years ago

Hi @una , thanks so much!

It is my understanding that CSS Houdini supports custom parameters in the paint() method like this, which would be perfect for describing the points positions. However, I did not see any examples on houdini.how that utilise inputArguments, so I decided to use CSS variable to control the number and spacing of points and randomly generate X, Y myself.

How should it be done in your opinion? I was thinking that I can make the random positions once and cache them in the paintlet on the first render and then keep reusing them? That would be one way to make it not regenerate the positions on each CSS variable change/

gnikoloff commented 3 years ago

Update: I saw one of the examples actually supports inputArguments, but with a hint that says it is hidden behind a flag.

I would be happy to implement it on my own demo page and include the same hint text under the demo. For the purposes of it not constantly rerendering with different points when changing CSS variables, how about I just cache their positions on the first render and keep reusing them?

Please let me know

una commented 3 years ago

Yes yes inputArguments would be perfect for this. Unfortunately, they are not yet supported by the Paint Polyfill, and thus can't be used for houdini.how demos. We could have the demo as-is with the randomized segments, and add a similar note stating that the points are customizable via input arguments with a link to the full demo.

gnikoloff commented 3 years ago

Hey @una, that's cool then :) Is anything else needed on my part WRT to the merge request?

Btw I also have other demos, are you guys cool with multiple contributions from the same person?

Thanks!

una commented 3 years ago

@gnikoloff yes, other demos are welcomed with open arms! Sorry about the delay on this one. Do you have a demo with using the argument list to set the points? I'd really like to add a note on this one and link to that!