大家下午好, 我想旋轉一個圖像使用rotationY,但它總是旋轉基於圖像的左側有沒有辦法改變旋轉點爲圖像的中心?看起來你應該能夠使用transformAround()方法,但是我在找到transformAround的一個與圖像有關的示例時遇到問題。有沒有人有任何這樣或這樣做是錯誤的方式?我想要做的是建立一個幻燈片放映,旋轉,你點擊圖像放大。 感謝您的幫助,對於冗長的問題感到抱歉。如何使用Flash Builder 4.6沿Y軸旋轉圖像?
回答
由於您使用的是Flex框架,因此您可以使用Spark 3D效果來旋轉圖像,而不是使用變換大驚小怪。看下面的例子(你可以很容易地用你的圖像替換Rect
)。 Rotate3D的autoCenterTransform
屬性完成將x,y,z旋轉點移動到對象中心的所有工作。
<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
<s:Rotate3D
id="rotateEffect"
target="{myImage}"
angleYFrom="0"
angleYTo="360"
duration="1000"
autoCenterTransform="true"/>
</fx:Declarations>
<s:Button label="Rotate"
x="10" y="10"
click="rotateEffect.play()"/>
<s:Rect id="myImage"
x="20" y="40"
height="100" width="100">
<s:fill>
<s:SolidColor color="0xABABAB"/>
</s:fill>
</s:Rect>
</s:Application>
另外,如果你不想完全居中的轉換點,但只有卻將變換點,允許Y旋轉,您可以調整圖像的transformX
屬性如下:
<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
<s:Rotate3D
id="rotateEffect"
target="{myImage}"
angleYFrom="0"
angleYTo="360"
duration="1000"
/>
</fx:Declarations>
<s:Button label="Rotate"
x="10" y="10"
click="rotateEffect.play()"/>
<s:Rect id="myImage"
x="20" y="40"
height="100" width="100"
transformX="{myImage.width/2}">
<s:fill>
<s:SolidColor color="0xABABAB"/>
</s:fill>
</s:Rect>
</s:Application>
這正是我尋找的問題的答案!我只是在流浪你知道更多的信息,我可以閱讀以瞭解更多關於此?書籍或文章,如果不是它很酷,你做得更多,然後回答我的問題,非常感謝你! – Justin 2012-01-06 22:43:38
我從[Adobe文檔](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/effects/Rotate3D.html)獲取了所有這些信息。還有一個很好的例子[here](http://blog.flexexamples.com/2008/10/13/3d-rotating-objects-in-flex-using-the-fxrotate3d-effect-and-flash-player- 10 /)。 – eterps 2012-01-07 00:07:32
- 1. 如何沿y軸旋轉圖像?
- 2. 沿着x軸和y軸旋轉
- 3. 如何旋轉沿x軸的視圖
- 4. 無法使用Flash Builder 4.6
- 5. 如何在Flash Builder 4.6中使用ExtensionContext?
- 6. 在Flash Builder 4.6
- 7. Flash Builder 4.6 bug
- 8. 圍繞y軸旋轉圖像
- 9. Flash Professional CS6或Flash Builder 4.6
- 10. 使用圖像中心作爲旋轉軸旋轉圖像
- 11. 如何繞Y軸旋轉圖像(球體)?
- 12. 在Processing.JS中,如何繞y軸旋轉圖像?
- 13. 沿Z-軸旋轉在HTML5 - 倒裝卡
- 14. Flex中的HelloWorld使用flash builder 4.6
- 15. 在Pixi.js中旋轉後沿Y軸縮放
- 16. Flash Builder 4.6 |刪除子| | s:TileGroup
- 17. Flurry Analytics ANE和Flash Builder 4.6
- 18. Flash Builder 4.6移動版面
- 19. Flash Builder 4.6移動定位
- 20. Flash Builder 4.6接口編程
- 21. Adobe Illustrator到Flash Builder 4.6
- 22. Flash Builder的4.6 - MultiDPIBitmapSource問題
- 23. 旋轉圖表的X和Y軸
- 24. Y軸與錯旋轉
- 25. 圍繞Y軸旋轉
- 26. 在WPF中沿x軸旋轉畫布
- 27. 如何沿着x,y和z軸依次旋轉ModelVisual3D對象的中心
- 28. 如何使圖像自旋/圍繞z軸旋轉
- 29. 沿X軸旋轉的手機角度
- 30. 沿着世界座標軸旋轉
你使用Flex框架還是香草AS3? – 2012-01-05 19:48:11
柔性框架的工作。我正在將其全部構建到Android空中應用程序中。幻燈片放映將在平板電腦上進行。如果答案只是廣泛的話,我也不會介意知道是否有任何書籍。我可以認爲它更簡單。感謝您的回放! – Justin 2012-01-05 21:26:08