Exemple d'animation avec OpenLaszlo
<?xml version="1.0" encoding="ISO-8859-1" ?>
<canvas title="header" width="246" height="100" >
<view resource="palms.gif" x="0" y="0" />
<view x="0" y="0" width="246" height="${myhei}" bgcolor="white" opacity="${opa}">
<attribute name="opa" value="0.1" type="number" />
<attribute name="myhei" value="0" type="number" />
<animatorgroup process="simultaneous" repeat="Infinity">
<animator attribute="opa" from="0.1" to="0.8" duration="500" motion="linear" repeat="Infinity"/>
<animator attribute="myhei" from="0" to="100" duration="10000" motion="linear" repeat="Infinity"/>
</animatorgroup>
</view>
</canvas>
Un peu d'explication sur ce script:
on superpose une vue blanche sur une image; cette vue prend 2 paramétres que nous faisons varier. Les attributs "opa" et "myhei".
L'attribut "opa" définit l'opacité de la vue et l'attribut "myhei" la hauteur de la vue.
Nous faisons varier "opa" de 0.1 à 0.8, l'opacité est toujours comprise entre 0 et 1, par défaut 1.
Nous faisons varier "myhei" de 0 à 100, nous jouons ici sur la hauteur de la vue afin de l'agrandir jusqu'au bas de l'image.
Ce petit script vous montre comment faire varier les attributs d'une vue, vous pouvez jouer sur tous les attributs de cette maniére; alors amusez vous bien.