@zeplin/extension-model
Version:
Models exposed to Zeplin extensions
61 lines (60 loc) • 1.46 kB
TypeScript
import { ColorStop } from "./colorStop.js";
export type GradientType = "linear" | "radial" | "angular";
export declare const GRADIENT_TYPES: Record<string, GradientType>;
export interface Point {
x: number;
y: number;
}
export interface GradientData {
type: GradientType;
from: Point;
to: Point;
colorStops: any[];
angle?: number;
scale?: number;
aspectRatio?: number;
color?: any;
}
/**
* An interface to represent shadow of a Layer.
*/
export declare class Gradient {
/**
* Type of the shadow. It can be one of "linear", "radial", and "angular".
*/
type: GradientType;
/**
* Starting point of the gradient
*/
from: Point;
/**
* Ending point of the gradient
*/
to: Point;
/**
* The gradient line's angle of direction.
*/
angle?: number;
/**
* Scale of the gradient.
*/
scale?: number;
/**
* Aspect ratio of the gradient.
*/
aspectRatio?: number;
/**
* Colorstops of the gradient.
*/
colorStops: ColorStop[];
static get TYPE(): Record<string, GradientType>;
static get ALLOWED_FIELDS(): string[];
constructor(gradientData: GradientData, w?: number, h?: number);
/**
* Creates a Gradient instance from a JSON string
*
* @param json JSON string representing a gradient
* @returns A new Gradient instance
*/
static fromJSON(json: string): Gradient;
}