Mercurial > MadButterfly
comparison nodejs/examples/simple/test-translate.js @ 1412:3e80b5cf8da2
Testcase for redrawing image.
There is a report from wycc that redrawing is not working for image
(maybe other shapes). This testcase shows that he may forget to call
redraw_changed() after updating transform matrix.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 06 Apr 2011 10:44:15 +0800 |
parents | |
children | b8dfa491ed9d |
comparison
equal
deleted
inserted
replaced
1404:ce981aa3fbf2 | 1412:3e80b5cf8da2 |
---|---|
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- | |
2 // vim: sw=4:ts=8:sts=4 | |
3 var svg = require("svg"); | |
4 var mbapp = require("mbapp"); | |
5 var sys=require("sys"); | |
6 var animate=require("animate"); | |
7 | |
8 app = new mbapp.app(); | |
9 | |
10 coord_parent = app.mb_rt.coord_new(app.mb_rt.root); | |
11 coord = app.mb_rt.coord_new(coord_parent) | |
12 data=mbapp.ldr.load("sample.png"); | |
13 paint = app.mb_rt.paint_image_new(data); | |
14 img = app.mb_rt.image_new(10,10,50,50); | |
15 paint.fill(img); | |
16 coord.opacity = 0.9; | |
17 coord.add_shape(img); | |
18 | |
19 var shift = 0; | |
20 function translate_handler() { | |
21 coord_parent[2] = shift; | |
22 app.mb_rt.redraw_changed(); | |
23 setTimeout(translate_handler, 100); | |
24 shift = shift + 10; | |
25 } | |
26 | |
27 translate_handler(); | |
28 app.loop() |