<canvas width="780" height="700">
<view name="huan" resource="./res.png" x="200" y="400" xoffset="${this.width/2}" yoffset="${this.height/2}"
xscale="0.5" yscale="0.5" onclick="rotate()" onmouseover="lrg()" onmouseout="small()">
<method name="lrg">
canvas.huan.enlarge.doStart();
</method>
<method name="small">
canvas.huan.ensmall.doStart();
</method>
<animatorgroup name="anm" start="false">
<animator attribute="rotation" to="${canvas.huan.ratio}" duration="500" start="false" />
<animatorgroup start="false" process="simultaneous" motion="easeboth">
<animator attribute="xscale" to=".5" duration="200" start="false" />
<animator attribute="yscale" to=".5" duration="200" start="false" />
</animatorgroup>
<animator attribute="x" to="130" duration="500" start="false" />
<method event="onstop">
canvas.panel.exp.doStart();
</method>
</animatorgroup>
<animatorgroup name="enlarge" start="false" process="simultaneous" motion="easeboth">
<animator attribute="xscale" to="0.7" duration="200" start="false" />
<animator attribute="yscale" to="0.7" duration="200" start="false" />
</animatorgroup>
<animatorgroup name="ensmall" start="false" process="simultaneous" motion="linear">
<animator attribute="xscale" to="0.5" duration="100" start="false" />
<animator attribute="yscale" to="0.5" duration="100" start="false" />
</animatorgroup>
<method name="rotate">
<
]]>
</method>
</view>
<view name="panel" x="300" y="400" width="0" height="20" bgcolor="blue" opacity="0">
<animatorgroup name="exp" start="false">
<animator attribute="opacity" to=".3" duration="1" start="false" />
<animator attribute="width" to="400" duration="500" start="false" />
<animatorgroup start="false" process="simultaneous">
<animator attribute="y" to="300" duration="500" start="false" />
<animator attribute="height" to="200" duration="500" start="false" />
</animatorgroup>
<method event="onstop">
canvas.panel.textbox.setVisible(true);
</method>
</animatorgroup>
<animatorgroup name="inc" start="false">
<animatorgroup start="false" process="simultaneous">
<animator attribute="y" to="400" duration="500" start="false" />
<animator attribute="height" to="20" duration="500" start="false" />
</animatorgroup>
<animator attribute="width" to="0" duration="500" start="false" />
<method event="onstop">
canvas.panel.textbox.setVisible(false);
</method>
</animatorgroup>
<text name="textbox" visible="false">This is only a test</text>
</view>
</canvas>res.png为转盘图片
交互式动画与视图组件
本文介绍了一个基于canvas的交互式动画实现方案,详细解释了如何通过各种动画效果(如旋转、放大缩小等)来增强用户体验。同时,还探讨了如何通过鼠标事件触发动画,以及如何使用动画组实现复杂的动画效果。
616

被折叠的 条评论
为什么被折叠?



