PDA

View Full Version : Zooming


jpoloney
05-25-2006, 04:40 PM
After looking through the LZPix code, I was wondering how I could apply some of their zoom techniques to my application. Is it possible to zoom in/out of a LzView or is there a better way to do this rather than resizing every object inside?

jstretch
05-26-2006, 06:35 AM
You can use constraints on the inner views:


<canvas width="100%" height="100%" debug="true">
<view width="50" height="50" bgcolor="0xCCCCCC">
<animator name="grow" attribute="width" to="500" duration="500" start="false"></animator>
<animator name="shrink" attribute="width" to="50" duration="500" start="false"></animator>
<view width="${parent.width/2}" height="${parent.height/2}" align="center" valign="middle" bgcolor="0x000000" />
<method event="onclick">
if(this.width > 50)
this.shrink.doStart();
else
this.grow.doStart();
</method>
</view>
</canvas>

jpoloney
05-26-2006, 08:18 AM
I found that I can do it by stretching the views. This in turn stretches the objects inside. It's not the cleanest way to do it, but if I have an animator od all the work, I'm going to need to do that for every object inside (some not native LZX objects).