CSS conic-gradient() Polyfill

conic-gradient

<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<script src="conic-gradient.js"></script>

Conic gradients are awesome, but browsers haven’t realized yet. This polyfill lets you experiment with them now.

By Lea Verou. Automatically creates an SVG which is set as the background. Uses -prefix-free.

Alternatively you can also use the JavaScript API behind it directly:

var gradient = new ConicGradient({
    stops: "gold 40%, #f06 0", // required
    repeating: true, // Default: false
    size: 400 // Default: Math.max(innerWidth, innerHeight)
});

console.log(gradient.svg); // SVG markup
console.log(gradient.png); // PNG image (fixed dimensions) as a data URL
console.log(gradient.dataURL); // data URL
console.log(gradient.blobURL); // blog URL

CSS conic-gradient() Polyfill →

Elsewhere , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *