graph and function
jhurley at infostations.com
Mon Nov 18 10:08:00 CST 2002
Wilhelm Sanke wrote:
>here is an example to draw functions from a stack used to introduce
>- The first sript sets the values for the coordinates (and is then
>called from the first mouseup-handler):
> choose line tool
> drag from (10 , 125) to (370, 125)
> drag from (10 , 0) to (10 , 250)
> set the width of the templateField to 25
> set the height of the templateField to 25
> set the textAlign of the templateField to "center"
> set the opaque of the templateField to false
> set the showBorder of the templateField to false
There is a tool which is very useful in introducing students to
graphics and that is Turtle Graphics first introduced in Logo. It is
not difficult to implement in Rev as well.
For example, to draw a sine curve with an amplitude of 100 pixels,
the button script would be:
StartTurtle -- initiate Turtle Graphics
repeat with a = 0 to 360
setxy a, 100*sine(a)
Where "StartTurtle" and "sine()" have been defined for the students
in the stack script. ("Sine" differs from "Sin")
function sine a
return sin(pi/180* a)
The axes may be drawn with such simple statements as "Forward 100"
and "Setheading 90"
More information about the use-livecode