Wednesday, September 9, 2009

Why Degrafa is so COOL Part 2 : Repeaters and RotateTransforms

Part 2: Rotate transform an image .
this is a part of the sample app in my recent post (viewable here)
code below .. some explanations ..





1. a BitmapFill that uses a source propery of the selected image.
2. a geoGroup (GeometryGroup) to create it as a Sprite inside our surface.
3. a RegularRectangle that will be filled with the image.
4. a RotateTransform with a property of registrationPoint as "Center" in order to make the image (rectengle) rotate around it's center



<!-- the image of the air craft's group -->
<degrafa:GeometryGroup id="plane">

<degrafa:RegularRectangle width="120" height="45" fill="{fillPlane}" x="65" y="100">

<degrafa:transform>

<degrafa:RotateTransform id="transform" registrationPoint="center" angle="0"/>

</degrafa:transform>
</degrafa:RegularRectangle>

</degrafa:GeometryGroup>



private function onAngleChanged(event:Event):void
{
TweenMax.to(transform2,1.5,{angle:idSlider.value});

}

No comments:

Post a Comment