Render
Information about the render binding

drawRect

1
render.drawRect(x, y, width, height, color)
Copied!
Renders a rectangle using the specified parameters
Parameter
Type
Description
x
Number
X pos of the rect
y
Number
Y pos of the rect
width
Number
Width of the rect
height
Number
Height of the rect
color
​Color​
Color of the rect
​

drawRoundedRect

1
render.drawRoundedRect(x, y, width, height, radius, color)
Copied!
Renders a rounded rectangle
Parameter
Type
Description
x
Number
X pos of the rect
y
Number
Y pos of the rect
width
Number
Width of the rect
height
Number
Height of the rect
radius
Number
Radius of the rounded parts
color
​Color​
Color of the rect

drawGradientRect

1
render.drawGradientRect(x, y, width, height, alpha, bottomLeft, topLeft, bottomRight, topRight)
Copied!
Draws a gradient with values for all corners of a rectangle
Parameter
Type
Description
x
Number
X pos of the rect
y
Number
Y pos of the rect
width
Number
Width of the rect
height
Number
Height of the rect
alpha
Number
Alpha of the gradient
bottomLeft
​Color​
Color of the bottom left corner
topLeft
​Color​
Color of the top left corner
bottomRight
​Color​
Color of the bottom right corner
topRight
​Color​
Color of the top right corner

drawGradientRectHorizontal

1
render.drawGradientRectHorizontal(x, y, width, height, alpha, left, right)
Copied!
Draws a gradient horizontally (left to right)
Parameter
Type
Description
x
Number
X pos of the rect
y
Number
Y pos of the rect
width
Number
Width of the rect
height
Number
Height of the rect
alpha
Number
Alpha of the gradient
left
​Color​
Color of the left side
right
​Color​
Color of the right side

drawGradientRectVertical

1
render.drawGradientRectVertical(x, y, width, height, alpha, top, bottom)
Copied!
Draws a gradient vertically (top to bottom)
Parameter
Type
Description
x
Number
X pos of the rect
y
Number
Y pos of the rect
width
Number
Width of the rect
height
Number
Height of the rect
alpha
Number
Alpha of the gradient
top
​Color​
Color of the top side
bottom
​Color​
Color of the bottom side

drawGradientRoundedRect

1
render.drawGradientRoundedRect(x, y, width, height, radius, bottomLeft, topLeft, bottomRight, topRight)
Copied!
Draws a rounded gradient with values for all corners of a rectangle
The bottom left color's alpha determines the alpha for the entire rectangle
Parameter
Type
Description
x
Number
X pos of the rect
y
Number
Y pos of the rect
width
Number
Width of the rect
height
Number
Height of the rect
radius
Number
Radius of the rounded rect
bottomLeft
​Color​
Color of the bottom left corner
topLeft
​Color​
Color of the top left corner
bottomRight
​Color​
Color of the bottom right corner
topRight
​Color​
Color of the top right corner

drawGradientRoundHorizontal

1
render.drawGradientRoundHorizontal(x, y, width, height, radius, left, right)
Copied!
Draws a rounded gradient horizontally (left to right)
Parameter
Type
Description
x
Number
X pos of the rect
y
Number
Y pos of the rect
width
Number
Width of the rect
height
Number
Height of the rect
radius
Number
Radius of the rounded rect
left
​Color​
Color of the left side
right
​Color​
Color of the right side

drawGradientRoundVertical

1
render.drawGradientRoundVertical(x, y, width, height, radius, top, bottom)
Copied!
Draws a rounded gradient horizontally (top to bottom)
Parameter
Type
Description
x
Number
X pos of the rect
y
Number
Y pos of the rect
width
Number
Width of the rect
height
Number
Height of the rect
radius
Number
Radius of the rounded rect
top
​Color​
Color of the top side
bottom
​Color​
Color of the bottom side

applyGradient

1
render.applyGradient(x, y, width, height, alpha, bottomLeft, topLeft, bottomRight, topRight, function() {
2
...
3
(Render stuff here)
4
...
5
})
Copied!
Applies a gradient to any rendered object in the callback function
Parameter
Type
Description
x
Number
X pos of the rect
y
Number
Y pos of the rect
width
Number
Width of the rect
height
Number
Height of the rect
alpha
Number
Alpha of the final result
bottomLeft
​Color​
Color of the bottom left corner
topLeft
​Color​
Color of the top left corner
bottomRight
​Color​
Color of the bottom right corner
topRight
​Color​
Color of the top right corner
callback function
Function
create a function here to specify a specific group of objects for the gradient to be applied too

interpolateColors

1
var interpolatedColor = render.interpolateColors(colorOld, colorNew, percentage)
Copied!
Returns a an interpolated Color between the two colors based on the percentage
Parameter
Type
Description
colorOld
​Color​
Original color
colorNew
​Color​
New color to be interpolated to
percentage
Number
Percentage to interpolate with

applyOpacity

1
var color = client.getClientColors()[0]
2
var alpha = .5
3
var opaqueColor = render.applyOpacity(color, alpha)
Copied!
Applies opacity to a color with a value ranging from 0-1
Parameter
Type
Description
color
​Color​
Original color
alpha
Number
Alpha value of the new color

getScaledWidth

1
render.getScaledWidth()
Copied!
Returns the scaled width of the screen as a Number

getScaledHeight

1
render.getScaledHeight()
Copied!
Returns the scaled height of the screen as a Number

drawEntity3D

1
render.drawEntity3D(x, y, scale, yaw, pitch, entity)
Copied!
Parameter
Type
Description
x
Number
X pos of the entity
y
Number
Y pos of the entity
scale
Number
Scale of the entity
yaw
Number
Yaw of the entity
pitch
Number
Pitch of the entity
entity
​EntityLivingBase​
Entity to render

drawEntity2D

1
render.drawEntity2D(x, y, width, height, entity)
Copied!
Draws the entity's head
Parameter
Type
Description
x
Number
X pos of the entity's head
y
Number
Y pos of the entity's head
width
Number
Width of the entity's head
height
Number
Height of the entity's head
entity
​EntityLivingBase​
Entity to render

animate

1
var width = 0
2
​
3
script.onRender2D(function(event) {
4
width = render.animate(newValue, width, speed)
5
})
Copied!
This will animate the width value to the newValue depending on the speed
Parameter
Type
Description
newValue
Number
The endpoint of the animation
currentValue
Number
Current value of the animation
(Should be the value that you are setting too)
speed
Number
Speed of animation

Usage

A simple use case would be for a target hud health bar
1
var script = initScript({
2
name: "Animate test",
3
description: "animate testing",
4
author: "cedo"
5
})
6
​
7
var width = 0
8
​
9
script.onRender2D(function (event) {
10
var target = client.getAuraTarget()
11
if (!target) return null
12
var healthbarWidth = 100
13
var healthPercentage = target.getHealth() / target.getMaxHealth()
14
​
15
width = render.animateValue(healthbarWidth * healthPercentage, width, 5)
16
​
17
render.drawRect(100, 100, width, 80, color({red: 255, green: 255, blue: 255}))
18
​
19
})
Copied!