All Projects → GoogleChromeLabs → Css Paint Polyfill

GoogleChromeLabs / Css Paint Polyfill

Licence: apache-2.0
CSS Custom Paint / Paint Worklet polyfill with special browser optimizations.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Css Paint Polyfill

Ie8
some damn DOM fix for this damned browser
Stars: ✭ 297 (-48.35%)
Mutual labels:  polyfill
Avif.js
AVIF polyfill for the browser
Stars: ✭ 399 (-30.61%)
Mutual labels:  polyfill
Undom
🍩 1kb minimally viable DOM Document implementation
Stars: ✭ 496 (-13.74%)
Mutual labels:  polyfill
Polyfill Php70
This component provides features unavailable in releases prior to PHP 7.0.
Stars: ✭ 3,270 (+468.7%)
Mutual labels:  polyfill
Fakeindexeddb
A pure JS in-memory implementation of the IndexedDB API
Stars: ✭ 373 (-35.13%)
Mutual labels:  polyfill
Webappsec Trusted Types
A browser API to prevent DOM-Based Cross Site Scripting in modern web applications.
Stars: ✭ 424 (-26.26%)
Mutual labels:  polyfill
Formdata
HTML5 `FormData` polyfill for Browsers.
Stars: ✭ 292 (-49.22%)
Mutual labels:  polyfill
Gray
Make an image grayscale in all browsers
Stars: ✭ 568 (-1.22%)
Mutual labels:  polyfill
Polyfill Ctype
This component provides a partial, native PHP implementation for the Ctype extension.
Stars: ✭ 3,774 (+556.35%)
Mutual labels:  polyfill
Object Fit Polyfill
A Javascript polyfill for browsers that don't support the object-fit CSS property.
Stars: ✭ 493 (-14.26%)
Mutual labels:  polyfill
Promise Fun
Promise packages, patterns, chat, and tutorials
Stars: ✭ 3,779 (+557.22%)
Mutual labels:  polyfill
Loading Attribute Polyfill
Fast and lightweight dependency-free vanilla JavaScript polyfill for native lazy loading / the awesome loading='lazy'-attribute.
Stars: ✭ 335 (-41.74%)
Mutual labels:  polyfill
React Lifecycles Compat
Backwards compatibility polyfill for React class components
Stars: ✭ 457 (-20.52%)
Mutual labels:  polyfill
Standardized Audio Context
A cross-browser wrapper for the Web Audio API which aims to closely follow the standard.
Stars: ✭ 300 (-47.83%)
Mutual labels:  polyfill
Resize Observer
Polyfills the ResizeObserver API.
Stars: ✭ 540 (-6.09%)
Mutual labels:  polyfill
Url Polyfill
Polyfill URL and URLSearchParams to match last ES7 specifications
Stars: ✭ 294 (-48.87%)
Mutual labels:  polyfill
Polyfill Library
NodeJS module to create polyfill bundles tailored to individual user-agents.
Stars: ✭ 404 (-29.74%)
Mutual labels:  polyfill
Unfetch
🐕 Bare minimum 500b fetch polyfill.
Stars: ✭ 5,239 (+811.13%)
Mutual labels:  polyfill
Webassemblyjs
Toolchain for WebAssembly
Stars: ✭ 566 (-1.57%)
Mutual labels:  polyfill
Sugar
A Javascript library for working with native objects.
Stars: ✭ 4,457 (+675.13%)
Mutual labels:  polyfill

CSS Paint Polyfill demo

CSS Custom Paint / Paint Worklets polyfill npm

A polyfill that brings Houdini's CSS Custom Paint API and Paint Worklets to all modern browsers (Edge, Firefox, Safari and Chrome).

Performance is particularly good in Firefox and Safari, where this polyfill leverages -webkit-canvas() and -moz-element() for optimized rendering. For other browsers, framerate is governed by Canvas toDataURL() / toBlob() speed.

As of version 3, this polyfill also includes basic implementations of CSS.supports(), CSS.registerProperty() and CSS unit functions (CSS.px() etc), which are injected in browsers without native support.

What are Paint Worklets?

Paint Worklets are JavaScript modules in which you can program custom graphics code. Once registered, they can be applied to elements using CSS:

An example box.js worklet:

registerPaint('box', class {
  paint(ctx, geom, properties) {
    ctx.fillRect(0, 0, geom.width, geom.height)
  }
})

... registered and applied on a page:

CSS.paintWorklet.addModule('./box.js')

var el = document.querySelector('h1')
el.style.background = 'paint(box)'

For a more complete example, see the demo.


Installation & Usage

<script src="css-paint-polyfill.js"></script>
<!-- or: -->
<script src="https://unpkg.com/css-paint-polyfill"></script>

Or with a bundler:

import 'css-paint-polyfill';

... or with ES Modules on the web:

import 'https://unpkg.com/css-paint-polyfill';

Contributing

See CONTRIBUTING.md.

To hack on the polyfill locally:

git clone [email protected]:GoogleChromeLabs/css-paint-polyfill.git
cd css-paint-polyfill
npm i
npm start
# open http://localhost:5000

css-paint-polyfill

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].