This shows you the differences between two versions of the page.
sample_code:image_rotate [2016/08/16 13:42] gamecreator created image rotate sample |
sample_code:image_rotate [2016/08/16 22:05] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | **Battery Level** | ||
- | |||
- | This is a simple app that displays battery level and also notifies it on the notification bar. | ||
- | |||
- | <code JavaScript> | ||
- | //globals | ||
- | xm=4; ym=4; //images x×y | ||
- | i=0; //rotation counter | ||
- | |||
- | // | ||
- | |||
- | function OnStart() { | ||
- | lay=app.CreateLayout(" | ||
- | |||
- | canv=app.CreateImage(null, | ||
- | canv.SetAutoUpdate(false); | ||
- | lay.AddChild(canv); | ||
- | |||
- | app.AddLayout(lay); | ||
- | |||
- | img=app.CreateImage("/ | ||
- | setInterval(rotate) | ||
- | } | ||
- | |||
- | function rotate() { | ||
- | i+=0.0005; //rotation value | ||
- | |||
- | canv.Clear(); | ||
- | |||
- | for (a=0; a<xm; a++) { | ||
- | for (b=0; b<ym; b++) { | ||
- | //draw images | ||
- | Vs=Math.sin(180*(i+b/ | ||
- | Vc=Math.cos(180*(i+b/ | ||
- | canv.DrawImageMtx(img, | ||
- | }} | ||
- | canv.Update(); | ||
- | } | ||
- | </ | ||