New Page 1

How To Do - Example Projects

Click on the title to open the example project
Click on the How to projects above to see the basic sample code to help you create your projects quickly and efficiently.
Each "How To" has a overall description as well as a basic line by line detail of code.
You can download the project or copy the menu file to clipboard
 
Basic Entities     Basic animation     Basic functions  
Add Image   Create button   Basic math operations
Draw colour boxes   Show page - multiple pages   Math functions
Draw colour lines   Flashing text message   Create random number
Draw colour vectors   Animation with pointers   Plus and Minus
Draw colour circles   Scroll text message   Show and format Time and Date
Draw colour ellipses   Move images (TouchX, TouchY)   Save Timestamp to text file  
Draw arcs (ellipses with angle)   Move images with buttons   Password Entry Lock  
Add multiple rows text     Move images (press button)     Menu Selection  
Use pointers   Create slider      
Text Hello World   Show and hide entities   Graphs
Create Dynamic Entities     Dial needle   Create X-Bar Graph
      PNG Transparency     Create Y-Bar Graph  
Interfaces and Hardware             Trace graph from array  
Create IO Counter           Draw sinusoid graph   
External Key             Draw graph - DNA style
Use A to D converters           Draw line graph  
Send and receive data - RS232          
Keyboard Control            
           
 

How to do animation with pointers

Create a library with the background image

Create a libraries with images for animation
We use here bmp files and to hide the background we set the proper background colour.

These files have numbers as names. To create a good animation you have to keep appropriate order in file names.

When we have proper images we can create the loop wich will load images to IMG entity and refresh the page.
In this way we can get animation.

To create this functionality we need to use to variables, loop one conditional and some calculation.



Create the number variable "num" - we use it to calculate the current image number.
Create the pointer variable which allow us to create proper name for each image .

Create a style for page with the image as background
Create a style for image - alignment to center.

Define a page named "pageName" with style "pageStyle"

Set current position to X=240px, Y=136px
Create image entity named "image1" with "atr1" as image

Create endless loop 'animation'
Load to the pointer variable the name for the next image
Reload image entity 'image1' with new image name from pointer, two semicolons refresh (redraw) the page
Check if the number not exceed 17 and increase the number or reload it with 1
Wait 45ms

After loading show the page named "pageName"named "pageName"

LIB(background,"SDHC/bground.png");
LIB(atr17, "SDHC/17.bmp?back=\\ffffff");
LIB(atr16, "SDHC/16.bmp?back=\\ffffff");
LIB(atr15, "SDHC/15.bmp?back=\\ffffff");
LIB(atr14, "SDHC/14.bmp?back=\\ffffff");
LIB(atr13, "SDHC/13.bmp?back=\\ffffff");
LIB(atr12, "SDHC/12.bmp?back=\\ffffff");
LIB(atr11, "SDHC/11.bmp?back=\\ffffff");
LIB(atr10, "SDHC/10.bmp?back=\\ffffff");
LIB(atr9, "SDHC/9.bmp?back=\\ffffff");
LIB(atr8, "SDHC/8.bmp?back=\\ffffff");
LIB(atr7, "SDHC/7.bmp?back=\\ffffff");
LIB(atr6, "SDHC/6.bmp?back=\\ffffff");
LIB(atr5, "SDHC/5.bmp?back=\\ffffff");
LIB(atr4, "SDHC/4.bmp?back=\\ffffff");
LIB(atr3, "SDHC/3.bmp?back=\\ffffff");
LIB(atr2, "SDHC/2.bmp?back=\\ffffff");
LIB(atr1, "SDHC/1.bmp?back=\\ffffff");

VAR(num,17,U8);
VAR(atrptr>"",PTR);
STYLE(pageStyle, Page) { image = background; }
STYLE(imageStyle, Image) { curRel=CC;}

PAGE(pageName, pageStyle)
{
POSN(240, 136);
IMG(image1,atr1,imageStyle);
LOOP(animation,FOREVER)
{
LOAD(atrptr>"atr",num);
IMG(image1,atrptr);;
IF(num<17?[CALC(num,num,1,"+");]:[LOAD(num,1);]);
WAIT(45);
}
}
SHOW(pageName);