UNPKG

easy-api.ts

Version:

A powerful library to create your own API with ease.

1 lines 1.72 kB
Object.defineProperty(exports,"__esModule",{value:!0});let tslib_1=require("tslib"),APIFunction_1=require("../../classes/structures/APIFunction"),canvas_1=require("@napi-rs/canvas"),Error_1=require("../../classes/structures/Error"),createCanvas_1=tslib_1.__importDefault(require("./createCanvas"));class CreateConicGradient extends APIFunction_1.APIFunction{name="$createConicGradient";description="Creates a gradient around a point with given coordinates.";parameters=[{name:"Gradient Name",description:"The name for this gradient.",type:APIFunction_1.ParamType.String,required:!0,rest:!1,defaultValue:null},{name:"Start Angle",description:"The angle at which to begin the gradient, in radians. The angle starts from a line going horizontally right from the center, and proceeds clockwise.",type:APIFunction_1.ParamType.Number,required:!0,rest:!1,defaultValue:null},{name:"X",description:"The x-axis coordinate of the center of the gradient.",type:APIFunction_1.ParamType.Number,required:!0,rest:!1,defaultValue:null},{name:"Y",description:"The y-axis coordinate of the center of the gradient.",type:APIFunction_1.ParamType.Number,required:!0,rest:!1,defaultValue:null}];usage="$createConicGradient[gradientName;startAngle;x;y]";returns=APIFunction_1.ParamType.Unknown;aliases=[];compile=!0;parent=new createCanvas_1.default;async run(e){var[a,n,r,t]=await this.resolveTypedFields();if(!(e.parent.getInternalVar("NodeJS.Canvas")instanceof canvas_1.Canvas))throw new Error_1.EATS_Error(`Environment#canvas is not a instance of Canvas: "${e.function?.name}"`);n=e.parent.getInternalVar("NodeJS.CanvasContext").createConicGradient(n,r,t),e.parent.setInternalVar("NodeJS.Gradients:"+a,n)}}exports.default=CreateConicGradient;