Promotic
WikipediaLinkedInYoutubeTwitterFacebook

arc - method of the CanvasCtx object

Description:
Creates complete or partial circle.
Syntax:
Object arc(Long x, Long y, Long r, Long startAngle, Long endAngle, [Long counterclockwise])
Parameters:
x(Long) The x-coordinate of the circle center
y(Long) The y-coordinate of the circle center
r(Long) The radius of the circle
startAngle(Long) The circle drawing starting angle in radians (0 means that is at the 3 o'clock position)
endAngle(Long) The ending angle in radians
counterclockwise[optional] (Long) Specifies whether the drawing should be counterclockwise or clockwise.
false - clockwise
true - counter-clockwise
Note:
In order to create a circle you have to set: startAngle=0 and endAngle=2*Pm.PI.
 
The method creates a path. Therefore before this method is called the beginPath method should be called. For the rendering itself the stroke or fill method is used.
 
This method is also functional in Web panels.
See also:
- CanvasCtx.arcTo (method)
Example1:
The ctx variable represents the drawing canvas (CanvasCtx). The setup is done on the "Draw" tab at the beginning of the script of drawing event onDraw as follows:
 
var ctx = pEvent.GetCtx(1);
JavaScriptSelect and copy to clipboard

ctx.beginPath();
ctx.arc(100, 45, 50, 0, 2 * Pm.PI);
ctx.stroke();
Example2:
JavaScriptSelect and copy to clipboard

ctx.beginPath();
ctx.arc(100, 45, 50, 0, 1.5 * Pm.PI);
ctx.stroke();
Example3:
JavaScriptSelect and copy to clipboard

ctx.beginPath();
ctx.arc(100, 75, 50, Pm.PI, 2 * Pm.PI);
ctx.stroke();

History:
Pm8.02.06: Created
PROMOTIC 9.0.13 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice