Add background image to library
Create page style
Create a trace graph style
Create variables for X Y XS
Create variables for Shift, col and test
Define a page named "pageName" with style "pageStyle"
Create a graph
Create a key that runs graphF
Create graphF
resets graph
Calculates a random number between 0-200 into Shift
Creates a loop that runs 205 times
Calculates XS by adding random number to X
Calculates Y value by SIN the XS
Multiplies Y by 70
Adds 95 to Y
Calculate x modules 40 into test
if test = 0 then generate col using random command and change graph col
draw graph at X Y
Take 20 from Y
Add 10 to X
Draw graph at X Y
Take 8 from X
Reset X value
Run graphF function
After loading show the page named "pageName"
|
LIB(background,"SDHC/bground.png");
STYLE(pageStyle,Page){image=bground;}
STYLE(gstyle,DRAW){type=trace;col=blue;width=4;curRel=CC;}
VAR(Y,0,FLT4);VAR(X,0,U16);VAR(XS,0,U16);
VAR(Shift,0,U16);VAR(Col,0,U32);VAR(Test,0,U8);
PAGE(pageName,pageStyle)
{
DRAW(graph1,420,190,gstyle,240,130);
KEY(key1,graphF,480,272,TOUCHR,240,136);
}
FUNC(graphF)
{
RESET(graph1);
CALC(Shift,200,"RND");
LOOP(Loop1,205)
{
CALC(XS,Shift,X,"+");
CALC(Y,XS, "SIN" );
CALC(Y,Y,70,"*");
CALC(Y,Y,95,"+");
CALC(Test,X,40,"%");
IF(Test=0?[CALC(Col,16777215,"RND");LOAD(gstyle.col,Col);]);
DRAW(graph1,X,Y);
CALC(Y,Y,20,"-");
CALC(X,X,10,"+");
DRAW(graph1,X,Y);
CALC(X,X,8,"-");
}
LOAD(X,0);;
}
RUN(graphF);
SHOW(pageName);
|