Table Of Contents

Graph IDEProgramming ► Circle

The following is a complete script for programming a Circle graphic. When animated, it makes the circle blink and move around in a circle. Remember to set the Execute During Animation Program state if you animate a graphic.

/* Declarations */

double cos(double a);
double sin(double a);

@@class() Circle:Object

@@method(public, class) (id)alloc;
@@method(public, instance) (id)init;
@@method(public, instance) (unsigned)animationCount;
@@method(public, instance) (void)setCurveRed:(double)red green:(double)green blue:(double)blue alpha:(double)alpha;
@@method(public, instance) (void)setInteriorRed:(double)red green:(double)green blue:(double)blue alpha:(double)alpha;
@@method(public, instance) (void)moveCenterToXValue:(double)xValue yValue:(double)yValue;
@@method(public, instance) (void)sizeToCenteredWidth:(double)width height:(double)height;
@@method(public, instance) (void)release;

@@end

/* Execution block */

{
id myCircle;
int ii;
unsigned animationCount;
double red, green;
double xValue, yValue;

myCircle = [[Circle alloc] init];

animationCount = [myCircle animationCount];

red = (animationCount % 10) / 10.0;
green = (animationCount % 20) / 20.0;

xValue = 250.0 + 100.0 * cos(animationCount/20.0);
yValue = 250.0 + 100.0 * sin(animationCount/20.0);

[myCircle setInteriorRed:1.0 green:green blue:1.0 alpha:1.0];
[myCircle setCurveRed:red green:1.0 blue:1.0 alpha:1.0];
[myCircle moveCenterToXValue:xValue yValue:yValue];

[myCircle release];

}

The general API is define in the section Graphic. The following is API description specific to the Circle graphic.

@@method(public, instance) (void)setWedgeStartAngle:(double)startAngleInRadians endAngle:(double)endAngleInRadians;
  Call like this:

[myCircle setWedgeStartAngle:0.0 endAngle:3.1415926];

Sets the start and end angle of the circle. The angles are specified in unit of radian.




© Copyright 1993-2022 by VVimaging, Inc. (VVI); All Rights Reserved. Please email support@vvi.com with any comments you have concerning this documentation. See Legal for trademark and legal information.