Skip to main content
Version: v3

ARC

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

arc_sample

Arc widget to display arc progress. Support setting line width, color, start and end angle.

Create UI widget

import { createWidget, widget } from '@zos/ui'

const arc = createWidget(widget.ARC, Param)

Type

Param: object

PropertiesDescriptionRequiredType
xThe x-coordinate of widgetsYESnumber
yThe y-coordinate of widgetsYESnumber
wThe width of widgetsYESnumber
hThe height of widgetsYESnumber
radiusRadiusYESnumber
start_angleThe angle at the beginning of the arc. (0 degrees is the positive three o'clock direction)YESnumber
end_angleThe angle at the end of the arc. (0 degrees is the positive three o'clock direction)YESnumber
line_widthWidth of circular arc.YESnumber
colorColor of circular arc.YESnumber
info

The ARC widget draws an ellipse within the boundaries of a rectangle of width w and height h with the (x,y) coordinates as the upper left corner, and then cuts it into an arc at a given angle

Code example

import { createWidget, widget, prop } from '@zos/ui'

Page({
build() {
const arc = createWidget(widget.ARC, {
x: 100,
y: 100,
w: 250,
h: 250,
start_angle: -90,
end_angle: 90,
color: 0xfc6950,
line_width: 20
})

arc.addEventListener(event.CLICK_DOWN, (info) => {
arc.setProperty(prop.MORE, {
y: 150
})
})
}
})