annotate nodejs/examples/simple/test-translate.js @ 1496:042587afed2e

Add popup menu for transition
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 03 May 2011 12:35:04 +0800
parents b8dfa491ed9d
children
rev   line source
1412
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*-
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
2 // vim: sw=4:ts=8:sts=4
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
3 var svg = require("svg");
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
4 var mbapp = require("mbapp");
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
5 var sys=require("sys");
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
6 var animate=require("animate");
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
7
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
8 app = new mbapp.app();
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
9
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
10 coord_parent = app.mb_rt.coord_new(app.mb_rt.root);
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
11 coord = app.mb_rt.coord_new(coord_parent)
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
12 data=mbapp.ldr.load("sample.png");
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
13 paint = app.mb_rt.paint_image_new(data);
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
14 img = app.mb_rt.image_new(10,10,50,50);
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
15 paint.fill(img);
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
16 coord.add_shape(img);
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
17
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
18 var shift = 0;
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
19 function translate_handler() {
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
20 coord_parent[2] = shift;
1413
b8dfa491ed9d Use app.refresh() instead of redraw_changed()
Thinker K.F. Li <thinker@codemud.net>
parents: 1412
diff changeset
21 app.refresh();
1412
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
22 setTimeout(translate_handler, 100);
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
23 shift = shift + 10;
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
24 }
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
25
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
26 translate_handler();
3e80b5cf8da2 Testcase for redrawing image.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
27 app.loop()