View Full Version : Animator attributes
rajgerman
11-29-2007, 02:38 AM
Hey,
I have been playing around with the animator attributes and so far have looked at opacity, width, height and rotation. Are there any other attributes and where?, because I have not manged to find these.
Regards
Raj
senshi
11-29-2007, 02:24 PM
Actually, you can use any attribute. Or better just an attribute where it makes sense, i.e. opacity, width, height, x, y, bgcolor and so on => any attribute with numeric value!
rajgerman
12-03-2007, 02:04 AM
Thanks for that. For example how would i use the animator with bgcolor? How do i set the value of the color?
<animator name="myAnimator8" attribute="bgcolor" duration="100" start="false" relative="true"/>
<button onmousedown="a.myAnimator8.doStart()" onmouseup="a.myAnimator8.stop()">Color</button>
Cheers
This is how I'd use the animator to change the color:
<canvas height="400">
<simplelayout axis="y"/>
<view name="colorview" width="100%" height="200" bgcolor="0x000000">
<attribute name="r" value="0" type="number"/>
<attribute name="g" value="0" type="number"/>
<attribute name="b" value="0" type="number"/>
<handler name="onr">
this.updatecolor();
</handler>
<handler name="ong">
this.updatecolor();
</handler>
<handler name="onb">
this.updatecolor();
</handler>
<method name="updatecolor">
this.setBGColor( parseInt( r )*256*256 + parseInt( g )*256 + parseInt( b ) );
</method>
</view>
<button text="click me to change color">
<method event="onclick">
parent.colorview.animate( 'r', Math.random() * 256, 1000 );
parent.colorview.animate( 'g', Math.random() * 256, 1000 );
parent.colorview.animate( 'b', Math.random() * 256, 1000 );
</method>
</button>
</canvas>
rajgerman
12-05-2007, 06:48 AM
Would that also work for changing the color of images?
Cheers
Well for coloring images you can use setTint (in flash-runtime at least). For dhtml you would have to use a transparent view.
rajgerman
12-17-2007, 01:28 AM
I have an image in my view:
<view id="a" name="colorview" resource="images/5.jpg" stretches="both" x="300" y="205" clickable="true" onmousedown="dragger.apply()" onmouseup="dragger.remove()">
<dragstate name="dragger" drag_axis="both" drag_min_x="0" drag_max_x="$once{parent.width - this.width}" drag_min_y="0" drag_max_y="$once{parent.height - this.height}"/>
<animator name="myAnimator1" attribute="rotation" to="360" duration="5000" start="false" relative="true"/>
<animator name="myAnimator2" attribute="rotation" to="-360" duration="5000" start="false" relative="true"/>
<animator name="myAnimator3" attribute="opacity" from="1" to="0" duration="10000" start="false" />
<animator name="myAnimator4" attribute="width" to="5" duration="100" start="false" relative="true" repeat="Infinity" />
<animator name="myAnimator5" attribute="height" to="5" duration="100" start="false" relative="true" repeat="Infinity"/>
<animator name="myAnimator6" attribute="width" to="-5" duration="100" start="false" relative="true" repeat="Infinity"/>
<animator name="myAnimator7" attribute="height" to="-5" duration="100" start="false" relative="true" repeat="Infinity"/>
<animator name="myAnimator8" attribute="rotation" to="180" duration="1" start="false" relative="true"/>
</view>
How would i use the setTint method:
setTint(v, color, brightness);
Cheers
You can't use setTint on a simple view. Only basecomponents support setTint. setColorTransform(o) (as2) is supported on views. I'd suggest to embed the view in a basecomponent or inherit it and then tint it.
rajgerman
12-18-2007, 07:15 AM
Thanks for that. Say i have an image with 3 different colors. Say the image is comprised of a flower, a hand and the background color of the image. Would it be possible to say change the color of just the hand without affecting the other components of the image? Hope you understand my question.
Cheers
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.