Rotate images

This is an example for rotating images. Ayditional it is possible to draw x×y images.

//globals
xm=4; ym=4; //images x×y
i=0; //rotation counter
 
//Called when application is started.
 
function OnStart() {
	lay=app.CreateLayout("Linear","FillXY");
 
	canv=app.CreateImage(null,1,1,"fix",480,800);
	canv.SetAutoUpdate(false);
	lay.AddChild(canv);
 
	app.AddLayout(lay);
 
	img=app.CreateImage("/Sys/Img/Hello.png");
	setInterval(rotate)
}
 
function rotate() {
	i+=0.0005; //rotation value
 
	canv.Clear(); //clear canvas
 
	for (a=0; a<xm; a++) {
	for (b=0; b<ym; b++) {
		//draw images
		Vs=Math.sin(180*(i+b/ym+a/xm));
		Vc=Math.cos(180*(i+b/ym+a/xm));
		canv.DrawImageMtx(img,[Vs,0,-Vs/3+a/xm+1/xm/2,Vc/3,1,-Vc/16+b/ym+1/ym/2-0.2,0,0,1]);
	}}
canv.Update(); //update canvas
}