This tutorial will demonstrate you how to make line and set its linestlye(width,shape,alpha)
with SWiSHScript. The functions we will use in this tutorial are
lineStyle(width, color, alpha);
moveTo(x1,y1);
lineTo(x2,y2);
Description of lineStyle
-------------------------------------
This function is used for setting basic styles of the line you
are drwaing. For example if want line with following requirements
width = 2
color = black
alpha (visibility) = 50%
then you will use it like this
lineStyle(
Now if you want any other style you can simply change it from here.
Description of moveTo
-------------------------------------
This function has two parameters x1. When you will be making a line then you will have to tell the points from which points you want your line to be drawn,
for example if you want a line to be started from x=100 and y=100 then you will simply set your points like this
moveTo(100,10);
Basically without moveTo() and lineTo() you cannot make line. You can call this function as Start Point function.
Description of lineTo
-------------------------------------
This function also has two parameter, but it is different from moveTo(), becuase its x2 are
the end points of line for example if you want to make a line which will start from x=100, y=100, and now the end points x2=200,y2=100 It will make a line length of 100 pixels from points x1 to x2. You have seen then y1 and y2 are constant (100) so it will make a straight line on x=axis.
You can call this function as End Point Function, now if you are interested in blue color line, follow the example..
paste ths following code on frame 1 of mainTimeline..
onLoad () {
lineStyle(1, 223220, 100,1);
moveTo(10,10);
lineTo(100,10);
}
hope this tutorial will help you understand how to draw a line with SWiSHScript.
regards
- Ali Roman..
|
|
|