Menu

1 / 2

Progress component to implement a clock-style progress bar

DEV Community·HarmonyOS·6 months ago
#4sQrTgUs
Reading 0:00
15s threshold

Read the original article:Progress component to implement a clock-style progress bar

Requirement Description

How can I create a 360-degree circular dial and add a white dashed line that follows the rotation around the circumference (similar to a clock hand)?

Background Knowledge

Progress Bar (Progress): Progress is a progress bar display component that typically shows the current progress of a target operation. For specific usage, please refer to Progress .

Implementation Steps

The circular progress bar refers to the progress bar in the official documentation. The dashed lines are set using the Divider() component, and the rotation angle follows the progress of the progress bar.

Code Snippet / Configuration

@ Entry @ Component struct Index { @ State rotateAngle : number = 0 uiContext : UIContext | undefined = undefined ;

aboutToAppear () { this . uiContext = this . getUIContext (); if ( ! this . uiContext ) { console .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.