User Tools

Site Tools


Sidebar

Privacy Policy

News

Version 2.50 is out since Jan 1st 2022


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

sample_code:image_rotate

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
}
sample_code/image_rotate.txt · Last modified: 2016/08/16 22:05 (external edit)