html-squircle
Version:
Utilities for generating superellipse squircles in the form of SVG strings, to be used in clip-path and background inline styles.
11 lines • 607 B
JavaScript
import { backgroundSquircleObj } from "./backgroundSquircle.js";
import { clipSquircleObj } from "./clipSquircle.js";
const isOptionsBackground = opts => "stroke" in opts || "strokeWidth" in opts || "background" in opts || "injectedDefs" in opts || "injectedBody" in opts;
/**
* Overloaded function for getting either the background or clip squircle
* objects. Returns a result based on whether any background options are present
* in the options object.
*/
export function eitherSquircleObj(options) {
return isOptionsBackground(options) ? backgroundSquircleObj(options) : clipSquircleObj(options);
}