0.1.3 • Published 3 years ago

@houdini-css-paint/deep-sea v0.1.3

Weekly downloads
28
License
MIT
Repository
github
Last release
3 years ago

CSS Houdini Deep Sea

A CSS Houdini Paintlet to render stylised 2D sea floor.

Deep Sea Paintlet Render

Demo Page - http://css-houdini-dojo.georgi-nikolov.com

1. Load the Worklet

Using CDN is the easiest way to add this Worklet:

if ('paintWorklet' in CSS) {
  CSS.paintWorklet.addModule('https://unpkg.com/@houdini-css-paint/deep-sea/index.js');
}

2. Polyfill

To add support for all modern browsers, you can load the worklet with css-paint-polyfill fallback.

<script>
  ;(async function() {
    if (CSS['paintWorklet'] === undefined)
      await import('https://unpkg.com/css-paint-polyfill')

    CSS.paintWorklet.addModule('https://unpkg.com/@houdini-css-paint/deep-sea/index.js')
  })()
</script>

3. Using the Paintlet

To use this Paintlet after you have succesffuly loaded it, you need to add background(-image): paint(deep-sea) to any HTML element on your page. You can control its appearance just like any other regular image referenced in CSS with properties such as background-size, background-repeat, background-position and so on.

.my-element {
  --deep-sea-bubbles-count: 36;
  --deep-sea-grass-count: 100;
  --deep-sea-background-color: #110755;
  --deep-sea-grass-color: #639c5b;
  --deep-sea-grass-height: 50%;

  background-image: paint(deep-sea);
}
PropertyDescriptionDefault Value
--deep-sea-bubbles-countHow many bubbles to render100
--deep-sea-grass-countHow much individual grass stems to render100
--deep-sea-background-colorBackground color#6ab04c
--deep-sea-grass-colorGrass color#639c5b
--deep-sea-grass-heightGrass height in percentage60%

License

MIT License

0.1.3

3 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.4

3 years ago

0.1.5

3 years ago

0.0.6

3 years ago

0.0.2

3 years ago

0.0.4

3 years ago

0.0.1

3 years ago