適用於 Adobe® Flash® Platform 的 ActionScript® 3.0 參考
首頁  |  隱藏套件和類別清單 |  套件  |  類別  |  新增內容  |  索引  |  附錄  |  為什麼顯示英文?
篩選: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隱藏篩選
flash.geom 

Matrix3D  - AS3

套件x

最上層
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

語言元素

全域常數
全域函數
運算子
陳述式、關鍵字和指令
特殊類型

附錄

新增內容
編譯器錯誤
編譯器警告
執行階段錯誤
移轉至 ActionScript 3
支援的字元集
僅限 MXML 標籤
移動 XML 元素
Timed Text 標籤
不建議元素清單
AccessibilityImplementation 常數
如何使用 ActionScript 範例
法律聲明
套件flash.geom
類別public class Matrix3D
繼承Matrix3D Inheritance Object

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

Matrix3D 類別代表變形矩陣,用來決定三維 (3D) 顯示物件的位置和方向。矩陣可以執行變形功能,包括轉移 (沿著 x、y 和 z 軸調整位置)、旋轉和縮放 (調整大小)。Matrix3D 類別也可以執行透視投影,將點從 3D 座標空間對應到二維 (2D) 檢視。

一個矩陣可以合併多種變形,並一次套用到 3D 顯示物件上。例如,您可以將矩陣套用至 3D 座標以執行旋轉,接著再執行轉移。

當您明確設定顯示物件的 z 屬性或任何旋轉或縮放屬性時,就會自動建立對應的 Matrix3D 物件。

您可以透過 transform.matrix3d 屬性存取 3D 顯示物件的 Matrix3D 物件。2D 物件沒有 Matrix3D 物件。

2D 物件的 z 屬性值為零,而且其 matrix3D 屬性值為 null

注意:如果將同一個 Matrix3D 物件指定給兩個不同顯示物件,就會擲出執行階段錯誤。

Matrix3D 類別使用 4x4 正方形矩陣:保存變形資料的四列和四欄數字表格。矩陣的前三列分別保存 3D 軸 (x,y,z) 的資料。轉移資訊則位於最後一欄。方向和縮放資料位於前三欄。縮放因數是前三欄對角線上的數字。下面是 Matrix3D 元素的表示:

Matrix3D 元素

即使不懂矩陣數學,您也一樣可以使用 Matrix3D 類別。它提供可簡化變形和投影工作的特定方法,如 appendTranslation()appendRotation()interpolateTo() 方法。您也可以使用 decompose()recompose() 方法或 rawData 屬性來存取基礎的矩陣元素。

顯示物件會快取其軸旋轉屬性,以便讓每個軸的獨立旋轉並管理不同的旋轉組合。當呼叫 Matrix3D 物件的方法以轉換顯示物件時,此物件的旋轉快取就會無效。

相關 API 元素



公用屬性
 屬性定義自
 Inheritedconstructor : Object
類別物件的參照或是特定物件實體的建構函數。
Object
  determinant : Number
[唯讀] 一個數字,用來決定矩陣是否可以反轉。
Matrix3D
  position : Vector3D
保留位置的 Vector3D 物件,即顯示物件在變形之參考座標內的 3D 座標 (x,y,z)。
Matrix3D
  rawData : Vector.<Number>
16 個數字的 Vector,其中每 4 個元素組成一欄,構成一個 4x4 矩陣。
Matrix3D
公用方法
 方法定義自
  
Matrix3D(v:Vector.<Number> = null)
建立 Matrix3D 物件。
Matrix3D
  
將另一個 Matrix3D 物件與目前的 Matrix3D 物件相乘,並附加在矩陣的結尾。
Matrix3D
  
appendRotation(degrees:Number, axis:Vector3D, pivotPoint:Vector3D = null):void
將遞增式旋轉附加在 Matrix3D 物件的結尾。
Matrix3D
  
appendScale(xScale:Number, yScale:Number, zScale:Number):void
將遞增式縮放 (即沿著 x、y 和 z 軸變更) 附加在 Matrix3D 物件的結尾。
Matrix3D
  
將遞增式轉移 (即沿著 x、y 和 z 軸重新定位) 附加在 Matrix3D 物件的結尾。
Matrix3D
  
傳回新的 Matrix3D 物件,新的物件為目前 Matrix3D 物件完全相同的副本。
Matrix3D
  
copyColumnFrom(column:uint, vector3D:Vector3D):void
將 Vector3D 物件複製到呼叫的 Matrix3D 物件的特定欄。
Matrix3D
  
copyColumnTo(column:uint, vector3D:Vector3D):void
將呼叫的 Matrix3D 物件的特定欄複製到 Vector3D 物件。
Matrix3D
  
copyFrom(sourceMatrix3D:Matrix3D):void
將來源 Matrix3D 物件中的所有矩陣資料複製到呼叫的 Matrix3D 物件。
Matrix3D
  
copyRawDataFrom(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void
將來源向量物件中的所有向量資料複製到呼叫的 Matrix3D 物件。
Matrix3D
  
copyRawDataTo(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void
將呼叫的 Matrix3D 物件中的所有矩陣資料複製到提供的向量。
Matrix3D
  
copyRowFrom(row:uint, vector3D:Vector3D):void
將 Vector3D 物件複製到呼叫的 Matrix3D 物件的特定列。
Matrix3D
  
copyRowTo(row:uint, vector3D:Vector3D):void
將呼叫的 Matrix3D 物件的特定列複製到 Vector3D 物件。
Matrix3D
  
Matrix3D
  
decompose(orientationStyle:String = "eulerAngles"):Vector.<Vector3D>
以包含 3 個 Vector3D 物件的 Vector,傳回變形矩陣的轉移、旋轉和縮放設定。
Matrix3D
  
使用不含其轉移元素的變形矩陣,將 Vector3D 物件從一個空間座標轉換成另一個空間座標。
Matrix3D
 Inherited
指出物件是否有已定義的指定屬性。
Object
  
將目前的矩陣轉換成單位矩陣。
Matrix3D
  
interpolate(thisMat:Matrix3D, toMat:Matrix3D, percent:Number):Matrix3D
[靜態] 朝目標矩陣的轉移、旋轉和縮放變形插補一個矩陣的轉移、旋轉和縮放變形。
Matrix3D
  
朝目標矩陣的轉移、旋轉和縮放變形插補這個矩陣。
Matrix3D
  
將目前的矩陣反轉。
Matrix3D
 Inherited
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。
Object
  
pointAt(pos:Vector3D, at:Vector3D = null, up:Vector3D = null):void
旋轉顯示物件,使其面對指定的位置。
Matrix3D
  
將目前的 Matrix3D 物件與另一個 Matrix3D 物件相乘,並附加在矩陣的開頭。
Matrix3D
  
prependRotation(degrees:Number, axis:Vector3D, pivotPoint:Vector3D = null):void
將遞增式旋轉附加在 Matrix3D 物件的開頭。
Matrix3D
  
prependScale(xScale:Number, yScale:Number, zScale:Number):void
將遞增式縮放 (即沿著 x、y 和 z 軸變更) 附加在 Matrix3D 物件的開頭。
Matrix3D
  
將遞增式轉移 (即沿著 x、y 和 z 軸重新定位) 附加在 Matrix3D 物件的開頭。
Matrix3D
 Inherited
指出指定的屬性是否存在,以及是否可列舉。
Object
  
recompose(components:Vector.<Vector3D>, orientationStyle:String = "eulerAngles"):Boolean
設定變形矩陣的轉移、旋轉和縮放設定。
Matrix3D
 Inherited
為迴圈作業設定動態屬性的可用性。
Object
 Inherited
傳回代表此物件的字串,根據地區特定慣例進行格式化。
Object
 Inherited
會傳回指定之物件的字串形式。
Object
  
使用變形矩陣,將 Vector3D 物件從一個空間座標轉換成另一個空間座標。
Matrix3D
  
使用變形矩陣,將數字的 Vector 從一個座標空間轉換成另一個座標空間。
Matrix3D
  
將目前的 Matrix3D 物件轉換成列與欄對調的矩陣。
Matrix3D
 Inherited
會傳回指定之物件的基本值。
Object
屬性詳細資訊

determinant

屬性
determinant:Number  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

一個數字,用來決定矩陣是否可以反轉。

Matrix3D 物件必須是可反轉的。您可以使用 determinant 屬性來確定 Matrix3D 物件是可反轉的。如果 determinant 為零,表示矩陣的反轉不存在。例如,如果矩陣的一整列或一整欄都是零,或者如果兩列或兩欄相等,determinant 就是零。Determinant 也會用來解答一系列的方程式。

只有正方形矩陣 (如 Matrix3D 類別) 才有 determinant。



實作
    public function get determinant():Number

相關 API 元素

position

屬性 
position:Vector3D

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

保留位置的 Vector3D 物件,即顯示物件在變形之參考座標內的 3D 座標 (x,y,z)。position 類別會讓使用者立即存取顯示物件的矩陣轉移向量,而不需要分解及重排矩陣。

您可以使用 position 屬性來取得及設定變形矩陣的轉移元素。



實作
    public function get position():Vector3D
    public function set position(value:Vector3D):void

相關 API 元素

rawData

屬性 
rawData:Vector.<Number>

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

16 個數字的 Vector,其中每 4 個元素組成一欄,構成一個 4x4 矩陣。

如果 rawData 屬性設定為不可反轉的矩陣,會擲回例外。Matrix3D 物件必須是可反轉的。如果需要不可反轉的矩陣,請建立 Matrix3D 物件的子類別。



實作
    public function get rawData():Vector.<Number>
    public function set rawData(value:Vector.<Number>):void

相關 API 元素

建構函式詳細資料

Matrix3D

()建構函式
public function Matrix3D(v:Vector.<Number> = null)

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

建立 Matrix3D 物件。Matrix3D 物件可以使用 16 個數字的 Vector 來初始化,其中每 4 個元素組成一欄。一旦建立 Matrix3D 物件,您就可以使用 rawData 屬性來存取其矩陣元素。

如果未定義任何參數,建構函式會產生單位或單位 Matrix3D 物件。在矩陣標記法中,單位矩陣的主對角線位置上所有元素的值都是一,而所有其他元素的值都是零。單位矩陣的 rawData 屬性值為 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1。單位矩陣的位置或轉移值為 Vector3D(0,0,0)、旋轉設定為 Vector3D(0,0,0),而縮放值為 Vector3D(1,1,1)

參數
v:Vector.<Number> (default = null) — 16 個數字的 Vector,其中每 4 個元素組成一欄,構成一個 4x4 矩陣。

相關 API 元素

方法詳細資訊

append

()方法
public function append(lhs:Matrix3D):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將另一個 Matrix3D 物件與目前的 Matrix3D 物件相乘,並附加在矩陣的結尾。結果會結合兩個矩陣變形。您可以將 Matrix3D 物件乘以許多矩陣。最終 Matrix3D 物件會包含所有變形的結果。

矩陣乘法不同於矩陣加法。矩陣乘法不具交換性。換句話說,A 乘以 B 不等於 B 乘以 A。使用 append() 方法時,乘法是在左邊發生,這表示 lhs Matrix3D 物件是在乘法運算子的左邊。

thisMatrix = lhs * thisMatrix;

第一次呼叫 append() 方法時,它會進行相對於父輩空間的修改。後續呼叫會相對於在結尾附加的 Matrix3D 物件的參考座標。

append() 方法會將目前矩陣取代為在結尾附加的矩陣。如果您要在結尾附加兩個矩陣但不要變更目前矩陣,請使用 clone() 方法複製目前矩陣,然後將 append() 方法套用至副本。

參數

lhs:Matrix3D — 乘以目前 Matrix3D 物件的左邊矩陣。

相關 API 元素

appendRotation

()方法 
public function appendRotation(degrees:Number, axis:Vector3D, pivotPoint:Vector3D = null):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將遞增式旋轉附加在 Matrix3D 物件的結尾。當 Matrix3D 物件套用至顯示物件時,矩陣會在 Matrix3D 物件的其他變形之後執行旋轉。

顯示物件的旋轉是由座標軸、繞此軸的遞增式旋轉角度,以及物件旋轉中心的選擇性樞紐點所定義。座標軸可以是任何一般方向。共用軸是 X_AXIS (Vector3D(1,0,0))、Y_AXIS (Vector3D(0,1,0)) 以及 Z_AXIS (Vector3D(0,0,1))。在航空用語中,y 軸的旋轉稱為「偏轉」(Yaw)。x 軸的旋轉稱為「俯仰」(Pitch)。z 軸的旋轉稱為「側滾」(Roll)。

變形的順序會有影響。先旋轉後轉移變形會產生與先轉移後旋轉變形不同的特效。

旋轉特效不是絕對的。它是相對於目前的位置和方向。若要對變形矩陣進行絕對變更,請使用 recompose() 方法。appendRotation() 方法也不同於顯示物件的軸旋轉屬性,如 rotationX 屬性。旋轉屬性一定是在任何轉移之前執行,而 appendRotation() 方法的執行是相對於矩陣現有的一切。若要確定您會取得與顯示物件軸旋轉屬性相似的特效,請使用 prependRotation() 方法,它會在矩陣的其他變形之前執行旋轉。

appendRotation() 方法的變形套用至顯示物件的 Matrix3D 物件時,顯示物件的快取旋轉屬性值便會無效。

讓顯示物件繞著相對於其位置的特定點其他變數的其中一個方式是,將物件的轉移設定為指定的點,使用 appendRotation() 方法來旋轉物件,然後將物件轉移回原始位置。在下列範例中,myObject 3D 顯示物件會繞著座標 (10,10,0) 進行 y 軸旋轉。

    
    myObject.z = 1; 
    myObject.transform.matrix3D.appendTranslation(10,10,0);
    myObject.transform.matrix3D.appendRotation(1, Vector3D.Y_AXIS);
    myObject.transform.matrix3D.appendTranslation(-10,-10,0);
     
    

參數

degrees:Number — 旋轉的角度。
 
axis:Vector3D — 旋轉的軸或方向。一般軸是 X_AXIS (Vector3D(1,0,0))、Y_AXIS (Vector3D(0,1,0)) 以及 Z_AXIS (Vector3D(0,0,1))。此向量的長度應為 1。
 
pivotPoint:Vector3D (default = null) — 決定物件旋轉中心的點。物件的預設樞紐點是其註冊點。

相關 API 元素

appendScale

()方法 
public function appendScale(xScale:Number, yScale:Number, zScale:Number):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將遞增式縮放 (即沿著 x、y 和 z 軸變更) 附加在 Matrix3D 物件的結尾。當 Matrix3D 物件套用至顯示物件時,矩陣會在 Matrix3D 物件的其他變形之後執行縮放變更。預設縮放因數為 (1.0, 1.0, 1.0)。

縮放是定義為一組沿著三個座標軸 (x,y,z) 的遞增式變更。您可以將每個軸乘以不同的數字。當縮放變更套用至顯示物件時,物件的大小會增加或減少。例如,將 x、y 和 z 軸設定為二,則會使物件的大小加倍,而將這些軸設定為 0.5,則會使大小減半。若要確定縮放變形只影響特定軸,請將其他參數設定為一。參數值為一表示沿著特定軸沒有縮放變更。

appendScale() 方法可用於調整大小,以及管理扭曲 (如顯示物件的展開或收縮) 或用於放大或縮小某個位置。在顯示物件的旋轉和轉移期間會自動執行縮放變形。

變形的順序會有影響。先調整大小後轉移變形會產生與先轉移後調整大小變形不同的特效。

參數

xScale:Number — 用於沿著 x 軸縮放物件的倍數。
 
yScale:Number — 用於沿著 y 軸縮放物件的倍數。
 
zScale:Number — 用於沿著 z 軸縮放物件的倍數。

相關 API 元素

appendTranslation

()方法 
public function appendTranslation(x:Number, y:Number, z:Number):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將遞增式轉移 (即沿著 x、y 和 z 軸重新定位) 附加在 Matrix3D 物件的結尾。當 Matrix3D 物件套用至顯示物件時,矩陣會在 Matrix3D 物件的其他變形之後執行轉移變更。

轉移是定義為一組沿著三個座標軸 (x,y,z) 的遞增式變更。當變形套用至顯示物件時,顯示物件會依照參數所指定,從其目前位置沿著 x、y 和 z 軸移動。若要確定轉移只影響特定軸,請將其他參數設定為零。零參數表示沿著特定軸沒有變更。

轉移變更不是絕對的。它們會相對於矩陣的目前位置和方向。若要對變形矩陣進行絕對變更,請使用 recompose() 方法。變形的順序也有影響。先轉移後旋轉變形會產生與先旋轉後轉移不同的特效。

參數

x:Number — 沿著 x 軸的遞增式轉移。
 
y:Number — 沿著 y 軸的遞增式轉移。
 
z:Number — 沿著 z 軸的遞增式轉移。

相關 API 元素

clone

()方法 
public function clone():Matrix3D

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

傳回新的 Matrix3D 物件,新的物件為目前 Matrix3D 物件完全相同的副本。

傳回值
Matrix3D — 新的 Matrix3D 物件,為目前 Matrix3D 物件完全相同的副本。

copyColumnFrom

()方法 
public function copyColumnFrom(column:uint, vector3D:Vector3D):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 11, AIR 3.0, Flash Lite 4

將 Vector3D 物件複製到呼叫的 Matrix3D 物件的特定欄。

參數

column:uint — 要複製的目標欄。
 
vector3D:Vector3D — 從其中複製資料的 Vector3D 物件。

copyColumnTo

()方法 
public function copyColumnTo(column:uint, vector3D:Vector3D):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 11, AIR 3.0, Flash Lite 4

將呼叫的 Matrix3D 物件的特定欄複製到 Vector3D 物件。

參數

column:uint — 要從中複製資料的欄。
 
vector3D:Vector3D — 要複製的目標 Vector3D 物件。

copyFrom

()方法 
public function copyFrom(sourceMatrix3D:Matrix3D):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 11, AIR 3.0, Flash Lite 4

將來源 Matrix3D 物件中的所有矩陣資料複製到呼叫的 Matrix3D 物件。

參數

sourceMatrix3D:Matrix3D — 從其中複製資料的 Matrix3D 物件。

copyRawDataFrom

()方法 
public function copyRawDataFrom(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 11, AIR 3.0, Flash Lite 4

將來源向量物件中的所有向量資料複製到呼叫的 Matrix3D 物件。選擇性索引參數可讓您選取向量中任何開始槽。

參數

vector:Vector.<Number> — 從其中複製資料的向量物件。
 
index:uint (default = 0)
 
transpose:Boolean (default = false)

copyRawDataTo

()方法 
public function copyRawDataTo(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 11, AIR 3.0, Flash Lite 4

將呼叫的 Matrix3D 物件中的所有矩陣資料複製到提供的向量。選擇性索引參數可讓您選取向量中的任何目標開始槽。

參數

vector:Vector.<Number> — 要在其中複製資料的向量物件。
 
index:uint (default = 0)
 
transpose:Boolean (default = false)

copyRowFrom

()方法 
public function copyRowFrom(row:uint, vector3D:Vector3D):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 11, AIR 3.0, Flash Lite 4

將 Vector3D 物件複製到呼叫的 Matrix3D 物件的特定列。

參數

row:uint — 要將資料複製到其中的列。
 
vector3D:Vector3D — 從其中複製資料的 Vector3D 物件。

copyRowTo

()方法 
public function copyRowTo(row:uint, vector3D:Vector3D):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 11, AIR 3.0, Flash Lite 4

將呼叫的 Matrix3D 物件的特定列複製到 Vector3D 物件。

參數

row:uint — 要從中複製資料的列。
 
vector3D:Vector3D — 要將資料複製至其中的 Vector3D 物件。

copyToMatrix3D

()方法 
public function copyToMatrix3D(dest:Matrix3D):void

參數

dest:Matrix3D

decompose

()方法 
public function decompose(orientationStyle:String = "eulerAngles"):Vector.<Vector3D>

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

以包含 3 個 Vector3D 物件的 Vector,傳回變形矩陣的轉移、旋轉和縮放設定。第一個 Vector3D 物件會保存轉移元素。第二個 Vector3D 物件會保存旋轉元素。第三個 Vector3D 物件會保存縮放元素。

有些 Matrix3D 方法 (如 interpolateTo() 方法) 會自動分解並重排矩陣以執行其變形。

若要使用絕對父輩參考座標來修改矩陣的變形,請使用 decompose() 方法擷取設定並進行適當變更。然後,您可以使用 recompose() 方法,將 Matrix3D 物件設定為修改後的變形。

decompose() 方法的參數會指定適用於變形的方向樣式。預設方向為 eulerAngles,這會使用每個座標軸的三個獨立旋轉角度來定義方向。旋轉會連續發生,而且不會變更個別旋轉的軸。顯示物件的軸旋轉屬性會執行「尤拉角度」方向樣式變形。其他方向樣式選項為 axisAnglequaternion。軸角度方向會使用座標軸和角度的組合來決定方向。物件旋轉依據的軸是代表方向的單位向量。角度代表向量的旋轉量。方向也會決定顯示物件朝向的位置,而角度決定哪個方向是上方。appendRotation()prependRotation() 方法使用軸角度方向。四元數方向會使用複數和向量的第四個元素。三個旋轉軸 (x,y,z) 和一個旋轉角度 (w) 代表方向。interpolate() 方法使用四元數。

參數

orientationStyle:String (default = "eulerAngles") — 選擇性的參數,會決定矩陣變形使用的方向樣式。三種方向樣式為 eulerAngles (常數 EULER_ANGLES)、axisAngle (常數 AXIS_ANGLE) 和 quaternion (常數 QUATERNION)。如需有關不同方向樣式的詳細資訊,請參閱 geom.Orientation3D 類別。

傳回值
Vector.<Vector3D> — 包含 3 個 Vector3D 物件的 Vector,每個物件分別保存轉移、旋轉和縮放設定。

相關 API 元素


範例  ( 如何使用本範例 )

這個範例會使用 decompose()recompose() 方法,讓一個橢圓形水平延伸,同時朝消失點移動。decompose() 方法傳回的第一個 Vector3D 物件會保存轉移座標。第三個 Vector3D 物件會保存縮放設定。Vector3D 物件的 incrementBy() 方法會遞增矩陣的絕對轉移和縮放設定。
package {
    import flash.display.MovieClip;
    import flash.display.Shape;
    import flash.geom.*;
    import flash.events.Event;
    
    public class Matrix3DdecomposeExample extends MovieClip {
        private var ellipse:Shape = new Shape();

        public function Matrix3DdecomposeExample():void {
            
            ellipse.x = (this.stage.stageWidth / 2);
            ellipse.y = (this.stage.stageHeight - 40);
            ellipse.z = 1;
            ellipse.graphics.beginFill(0xFF0000);
            ellipse.graphics.lineStyle(2);
            ellipse.graphics.drawEllipse(0, 0, 50, 40);
            ellipse.graphics.endFill();
            addChild(ellipse);

            ellipse.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
        }

        private function enterFrameHandler(e:Event):void {  

            var v3:Vector.<Vector3D> = new Vector.<Vector3D>(3);
            v3 = ellipse.transform.matrix3D.decompose();
            v3[0].incrementBy(new Vector3D(0,0,1));
            v3[2].incrementBy(new Vector3D(0.01,0,0));
            ellipse.transform.matrix3D.recompose(v3);
        }
    }
}

deltaTransformVector

()方法 
public function deltaTransformVector(v:Vector3D):Vector3D

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

使用不含其轉移元素的變形矩陣,將 Vector3D 物件從一個空間座標轉換成另一個空間座標。傳回的 Vector3D 物件會保存已套用旋轉和縮放變形之後的新座標。如果 deltaTransformVector() 方法套用一個只包含轉移變形的矩陣,傳回的 Vector3D 就會與原始 Vector3D 物件相同。

您可以使用 deltaTransformVector() 方法讓某個座標空間中的顯示物件回應第二個顯示物件的旋轉變形。此物件不會複製旋轉,而是只會變更其位置以反映旋轉變更。例如,若要使用 display.Graphics API 繪製旋轉的 3D 物件,您必須將物件的旋轉座標對應至 2D 點。首先,在每次旋轉之後,使用 deltaTransformVector() 方法擷取物件的 3D 座標。然後,套用顯示物件的 local3DToGlobal() 方法,將 3D 座標轉移為 2D 點。接著,您就可以使用 2D 點繪製旋轉的 3D 物件。

注意:這個方法會自動將傳遞之 Vector3D 的 w 元件設定為 0.0。

參數

v:Vector3D — Vector3D 物件,保存即將變形的座標。

傳回值
Vector3D — 具有變形座標的 Vector3D 物件。

相關 API 元素

identity

()方法 
public function identity():void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將目前的矩陣轉換成單位矩陣。單位矩陣的主對角線上元素的值是一,而所有其他元素的值都是零。結果是 rawData 值為 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1、旋轉設定為 Vector3D(0,0,0)、位置或轉移設定為 Vector3D(0,0,0),以及縮放設定為 Vector3D(1,1,1) 的矩陣。下面是單位矩陣的表示。

單位矩陣

藉由套用單位矩陣所轉換的物件不會執行變形。換句話說,如果將矩陣乘以單位矩陣,結果是與原始矩陣相同的矩陣。

interpolate

()方法 
public static function interpolate(thisMat:Matrix3D, toMat:Matrix3D, percent:Number):Matrix3D

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

朝目標矩陣的轉移、旋轉和縮放變形插補一個矩陣的轉移、旋轉和縮放變形。

interpolate() 方法會避免使用方法 (如顯示物件的軸旋轉屬性) 時可能發生的不必要結果。interpolate() 方法會讓顯示物件的快取旋轉屬性值無效,而且會在內插補點之前將顯示物件的矩陣方向元素轉換為四元數。這個方法保證旋轉的最快、最有效路徑。它也會產生流暢、完全沒有平衡環鎖死的旋轉。在使用會獨立處理每個軸的「尤拉角度」時,可能會發生平衡環鎖死。在繞著兩個以上的軸旋轉時,這些軸可能會變得重疊,而導致意外結果。四元數旋轉會避免平衡環鎖死。

後續的 interpolate() 方法呼叫會產生顯示物件快速啟動,接著慢速靠近另一個顯示物件的效果。例如,如果您將 thisMat 參數設定為傳回的 Matrix3D 物件、將 toMat 參數設定為目標顯示物件相關聯的 Matrix3D 物件,而且將 percent 參數設定為 0.1,顯示物件就會朝向目標物件十個百分點的位置移動。在後續的呼叫或影格中,物件會以剩餘 90% 的十分之一移動,接著再以剩餘距離的十分之一移動,直到到達目標為止。

參數

thisMat:Matrix3D — 要插補的 Matrix3D 物件。
 
toMat:Matrix3D — 目標 Matrix3D 物件。
 
percent:Number — 一個介於 01 之間的值,會決定朝目標 Matrix3D 物件插補 thisMat Matrix3D 物件的百分點。

傳回值
Matrix3D — Matrix3D 物件,其中的元素會將此矩陣的值放置在原始矩陣和目標矩陣之間。當傳回的矩陣套用至 this 顯示物件時,此物件會以指定的百分點更接近目標物件移動。

相關 API 元素

interpolateTo

()方法 
public function interpolateTo(toMat:Matrix3D, percent:Number):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

朝目標矩陣的轉移、旋轉和縮放變形插補這個矩陣。

interpolateTo() 方法會避免使用方法 (如顯示物件的軸旋轉屬性) 時可能發生的不必要結果。interpolateTo() 方法會讓顯示物件的快取旋轉屬性值無效,而且會在內插補點之前將顯示物件的矩陣方向元素轉換為四元數。這個方法保證旋轉的最快、最有效路徑。它也會產生流暢、完全沒有平衡環鎖死的旋轉。在使用會獨立處理每個軸的「尤拉角度」時,可能會發生平衡環鎖死。在繞著兩個以上的軸旋轉時,這些軸可能會變得重疊,而導致意外結果。四元數旋轉會避免平衡環鎖死。

注意:若是內插補點,矩陣的縮放值將會重設,並且矩陣將會一般化。

後續的 interpolateTo() 方法呼叫會產生顯示物件快速啟動,接著慢速靠近另一個顯示物件的特效。例如,如果 percent 參數是設定為 0.1,顯示物件會朝向 toMat 參數所指定目標物件十個百分點的位置移動。在後續的呼叫或影格中,物件會以剩餘 90% 的十分之一移動,接著再以剩餘距離的十分之一移動,直到到達目標為止。

參數

toMat:Matrix3D — 目標 Matrix3D 物件。
 
percent:Number — 一個介於 01 之間的值,會決定顯示物件相對於目標的位置。此值越接近 1.0,顯示物件就會越接近其目前位置。此值越接近 0,顯示物件就會越接近目標。

相關 API 元素


範例  ( 如何使用本範例 )

在這個範例中,三維顯示物件 ellipse2 會朝另一個三維顯示物件 ellipse1 移動。ellipse2 會跟隨 ellipse1,嘗試捕捉它。如果 ellipse1 未繞著它的 y 軸旋轉,ellipse2 就會碰到 ellipse1 並落在它的上方。這兩個橢圓形是以相同的方向但分別位於不同的三維世界空間位置來繪製。
package {
    import flash.display.MovieClip;
    import flash.display.Shape;
    import flash.display.Graphics;
    import flash.geom.*;
    import flash.events.Event;

    public class InterpolateToExample extends MovieClip {
        private var ellipse1:Shape = new Shape();
        private var ellipse2:Shape = new Shape();

        public function InterpolateToExample():void {

            ellipse1 = myEllipses(250, 100, 500, 0xFF0000);
            addChild(ellipse1);
            
            ellipse2 = myEllipses(-30, 120, 1, 0x00FF00);
            addChild(ellipse2);

            addEventListener(Event.ENTER_FRAME, enterFrameHandler);
        }

        private function myEllipses(x:Number, y:Number, z:Number, c:Number):Shape {
            var s:Shape = new Shape();                            
            s.x = x;
            s.y = y;
            s.z = z;
            s.graphics.beginFill(c);
            s.graphics.lineStyle(2);
            s.graphics.drawEllipse(100, 50, 100, 80);
            s.graphics.endFill();
            return s;
        }

        private function enterFrameHandler(e:Event) {
            ellipse1.rotationY += 1;

            ellipse2.transform.matrix3D.interpolateTo(ellipse1.transform.matrix3D, 0.1);
        }
    }
}

invert

()方法 
public function invert():Boolean

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將目前的矩陣反轉。反轉矩陣與原始矩陣的大小相同,但會執行與原始矩陣相反的變形。例如,如果原始矩陣讓物件繞著 x 軸以某個方向旋轉,矩陣的反轉就會讓此物件繞此軸以相反方向旋轉。在物件套用反轉矩陣會取消原始矩陣所執行的變形。如果將矩陣乘以其反轉矩陣,結果就是單位矩陣。

矩陣的反轉可用來將某個矩陣除以另一個矩陣。將矩陣 A 除以矩陣 B 的方式是將矩陣 A 乘以矩陣 B 的反轉。反轉矩陣也可以用於攝影機空間。當攝影機在世界空間中移動時,世界空間中的物件必須以相反方向移動,以便從世界檢視轉換為攝影機或檢視空間。例如,如果攝影機更接近物件時,物件會變得較大。換句話說,如果攝影機在世界 z 軸向下移動,物件會在世界 z 軸向上移動。

invert() 方法會將目前矩陣取代為反轉矩陣。如果您要反轉矩陣但不要變更目前矩陣,請先使用 clone() 方法複製目前矩陣,然後將 invert() 方法套用至副本。

Matrix3D 物件必須是可反轉的。

傳回值
Boolean — 如果矩陣成功反轉則傳回 true

相關 API 元素

pointAt

()方法 
public function pointAt(pos:Vector3D, at:Vector3D = null, up:Vector3D = null):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

旋轉顯示物件,使其面對指定的位置。這個方法允許原地修改方向。顯示物件的前方向量 (at Vector3D 物件) 會指向指定的世界相對位置。顯示物件的上方是以 up Vector3D 物件指定。

pointAt() 方法會讓顯示物件的快取旋轉屬性值無效。此方法會分解顯示物件的矩陣,並且會修改旋轉元素以便讓物件轉向指定的位置。然後它會重排 (更新) 顯示物件的矩陣,因而執行變形。如果物件指向某個移動中目標 (如移動中物件的位置),在每個後續的呼叫中,此方法會讓物件朝移動中目標旋轉。

注意:如果您使用 Matrix3D.pointAt() 方法,但未設定選擇性參數,則根據預設值,目標物件不會朝向指定的全球相對位置。 您需要將 at 的值設為 -y-axis (0,-1,0) 以及將 up 設為 -z axis (0,0,-1)。

參數

pos:Vector3D — 目標物件的世界相對位置。「世界相對」會相對於世界空間和座標 (即所有物件的位置) 來定義物件變形。
 
at:Vector3D (default = null) — 物件相對的向量,會定義顯示物件指向的位置。「物件相對」會相對於物件空間 (即物件專屬的參考座標和座標系統) 來定義物件變形。預設值為 +y axis (0,1,0)。
 
up:Vector3D (default = null) — 物件相對的向量,會定義顯示物件的「上方」。如果繪製從上向下看的物件,+z 軸就是物件的「上方」向量。「物件相對」會相對於物件空間 (即物件專屬的參考座標和座標系統) 來定義物件變形。預設值為 +z-axis (0,0,1)。

相關 API 元素


範例  ( 如何使用本範例 )

在這個範例中,三角形會指向並跟隨橢圓形的移動路徑。橢圓形和三角形是設定在不同的位置。接著,橢圓形會向上移至舞台角落。三角形會跟隨橢圓形的轉移變更。您可以變更三角形的形狀以及 pointAt() 的「at」和「up」參數,查看它們對三角形移動的影響。
package {
    import flash.display.MovieClip;
    import flash.display.Shape;
    import flash.display.Graphics;
    import flash.geom.*;
    import flash.events.Event;

    public class PointAtExample extends MovieClip {
        private var ellipse:Shape = new Shape();
        private var triangle:Shape = new Shape();

        public function PointAtExample():void {
            ellipse.graphics.beginFill(0xFF0000);
            ellipse.graphics.lineStyle(2);
            ellipse.graphics.drawEllipse(30, 40, 50, 40);
            ellipse.graphics.endFill();
            ellipse.x = 100;
            ellipse.y = 150;
            ellipse.z = 1;

            triangle.graphics.beginFill(0x0000FF);
            triangle.graphics.moveTo(0, 0);
            triangle.graphics.lineTo(40, 40);
            triangle.graphics.lineTo(80, 0);
            triangle.graphics.lineTo(0, 0);
            triangle.graphics.endFill();
            triangle.x = 200;
            triangle.y = 50;
            triangle.z = 1;

            addChild(ellipse);
            addChild(triangle);

            ellipse.addEventListener(Event.ENTER_FRAME, ellipseEnterFrameHandler);
            triangle.addEventListener(Event.ENTER_FRAME, triangleEnterFrameHandler);
        }

        private function ellipseEnterFrameHandler(e:Event) {
            if(e.target.y > 0) {
                e.target.y -= 1;
                e.target.x -= 1;
            }
        }
        
        private function triangleEnterFrameHandler(e:Event) {
            e.target.transform.matrix3D.pointAt(ellipse.transform.matrix3D.position,
                                                Vector3D.X_AXIS, Vector3D.Y_AXIS);
        }
    }
}

prepend

()方法 
public function prepend(rhs:Matrix3D):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將目前的 Matrix3D 物件與另一個 Matrix3D 物件相乘,並附加在矩陣的開頭。結果會結合兩個矩陣變形。

矩陣乘法不同於矩陣加法。矩陣乘法不具交換性。換句話說,A 乘以 B 不等於 B 乘以 A。使用 prepend() 方法時,乘法是在右邊發生,這表示 rhs Matrix3D 物件是在乘法運算子的右邊。

thisMatrix = thisMatrix * rhs

prepend() 方法所做的修改會與物件空間相對。換句話說,這些修改一定會與物件的初始參考座標相對。

prepend() 方法會將目前矩陣取代為在開頭附加的矩陣。如果您要在開頭附加兩個矩陣但不要變更目前矩陣,請先使用 clone() 方法複製目前矩陣,然後將 prepend() 方法套用至副本。

參數

rhs:Matrix3D — 與目前 Matrix3D 物件相乘的矩陣的右邊。

相關 API 元素

prependRotation

()方法 
public function prependRotation(degrees:Number, axis:Vector3D, pivotPoint:Vector3D = null):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將遞增式旋轉附加在 Matrix3D 物件的開頭。當 Matrix3D 物件套用至顯示物件時,矩陣會在 Matrix3D 物件的其他變形之前執行旋轉。

顯示物件的旋轉是由座標軸、繞此軸的遞增式旋轉角度,以及物件旋轉中心的選擇性樞紐點所定義。座標軸可以是任何一般方向。共用軸是 X_AXIS (Vector3D(1,0,0))、Y_AXIS (Vector3D(0,1,0)) 以及 Z_AXIS (Vector3D(0,0,1))。在航空用語中,y 軸的旋轉稱為「偏轉」(Yaw)。x 軸的旋轉稱為「俯仰」(Pitch)。z 軸的旋轉稱為「側滾」(Roll)。

變形的順序會有影響。先旋轉後轉移變形會產生與先轉移後旋轉不同的特效。

旋轉特效不是絕對的。此特效是物件相對的,即相對於原始位置和方向的參考座標。若要對變形進行絕對變更,請使用 recompose() 方法。

prependRotation() 方法的變形套用至顯示物件的 Matrix3D 物件時,顯示物件的快取旋轉屬性值便會無效。

要讓顯示物件繞著相對於其位置的特定點旋轉,其中一個方式是將物件的轉移設定為指定的點,使用 prependRotation() 方法旋轉物件,然後將物件轉移回原始位置。在下列範例中,myObject 3D 顯示物件會繞著座標 (10,10,0) 進行 y 軸旋轉。

    
    myObject.z = 1; 
    myObject.transform.matrix3D.prependTranslation(10,10,0);
    myObject.transform.matrix3D.prependRotation(1, Vector3D.Y_AXIS);
    myObject.transform.matrix3D.prependTranslation(-10,-10,0);
     
    

參數

degrees:Number — 旋轉的角度。
 
axis:Vector3D — 旋轉的軸或方向。一般軸是 X_AXIS (Vector3D(1,0,0))、Y_AXIS (Vector3D(0,1,0)) 以及 Z_AXIS (Vector3D(0,0,1))。此向量的長度應為 1。
 
pivotPoint:Vector3D (default = null) — 決定旋轉中心的點。物件的預設樞紐點是其註冊點。

相關 API 元素


範例  ( 如何使用本範例 )

在這個範例中,使用者可以移動滑鼠,讓橢圓形繞著它的 xy 軸旋轉。在橢圓形的註冊點位於其中心的情況下,繪製此橢圓形。橢圓形會使用滑鼠的 x 座標,繞著它本身的 y 軸旋轉。它會使用滑鼠的 y 座標,繞著它本身的 x 軸旋轉。
package {
    import flash.display.MovieClip;
    import flash.display.Shape;
    import flash.geom.*;
    import flash.events.MouseEvent;
    
    public class Matrix3DprependRotationExample extends MovieClip {
        private var ellipse:Shape = new Shape();

        public function Matrix3DprependRotationExample():void {

            ellipse.graphics.beginFill(0xFF0000);
            ellipse.graphics.lineStyle(2);
            ellipse.graphics.drawEllipse(-50, -40, 100, 80);
            ellipse.graphics.endFill();

            ellipse.x = (this.stage.stageWidth / 2);
            ellipse.y = (this.stage.stageHeight / 2);
            ellipse.z = 1;
            
            addChild(ellipse);

            stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
        }

        private function mouseMoveHandler(e:MouseEvent):void {
            var y:int;
            var x:int;
            
            if(e.localX > ellipse.x) {
                y = (Math.round(e.localX) / 100);   
            } else {
                y = -(Math.round(e.localX) / 10);   
            }
            
            if(e.localY > ellipse.y) {
                x = (Math.round(e.localY) / 100);
            } else {
                x = -(Math.round(e.localY) / 100);
            }
            
            ellipse.transform.matrix3D.prependRotation(y, Vector3D.Y_AXIS);
            ellipse.transform.matrix3D.prependRotation(x, Vector3D.X_AXIS);
        }
        
    }
}

prependScale

()方法 
public function prependScale(xScale:Number, yScale:Number, zScale:Number):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將遞增式縮放 (即沿著 x、y 和 z 軸變更) 附加在 Matrix3D 物件的開頭。當 Matrix3D 物件套用至顯示物件時,矩陣會在 Matrix3D 物件的其他變形之前執行縮放變更。此變更是物件相對的,即相對於原始位置和方向的參考座標。預設縮放因數為 (1.0, 1.0, 1.0)。

縮放是定義為一組沿著三個座標軸 (x,y,z) 的遞增式變更。您可以將每個軸乘以不同的數字。當縮放變更套用至顯示物件時,物件的大小會增加或減少。例如,將 x、y 和 z 軸設定為二,則會使物件的大小加倍,而將這些軸設定為 0.5,則會使大小減半。若要確定縮放變形只影響特定軸,請將其他參數設定為一。參數值為一表示沿著特定軸沒有縮放變更。

prependScale() 方法可用於調整大小,以及管理扭曲,如顯示物件的展開或收縮。它也可以用於放大或縮小某個位置。在顯示物件的旋轉和轉移期間會自動執行縮放變形。

變形的順序會有影響。先調整大小後轉移變形會產生與先轉移後調整大小變形不同的特效。

參數

xScale:Number — 用於沿著 x 軸縮放物件的倍數。
 
yScale:Number — 用於沿著 y 軸縮放物件的倍數。
 
zScale:Number — 用於沿著 z 軸縮放物件的倍數。

相關 API 元素

prependTranslation

()方法 
public function prependTranslation(x:Number, y:Number, z:Number):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將遞增式轉移 (即沿著 x、y 和 z 軸重新定位) 附加在 Matrix3D 物件的開頭。當 Matrix3D 物件套用至顯示物件時,矩陣會在 Matrix3D 物件的其他變形之前執行轉移變更。

轉移指定顯示物件從其目前位置沿著 x、y 和 z 軸移動的距離。prependTranslation() 方法會將轉移定義為一組沿著三個座標軸 (x,y,z) 的遞增式變更。若要讓轉移只變更特定軸,請將其他參數設定為零。零參數表示沿著特定軸沒有變更。

轉移變更不是絕對的。此特效是物件相對的,即相對於原始位置和方向的參考座標。若要對變形矩陣進行絕對變更,請使用 recompose() 方法。變形的順序也有影響。先轉移後旋轉變形會產生與先旋轉後轉移變形不同的特效。使用 prependTranslation() 時,顯示物件會持續以其面向的方向移動,不論其他變形為何。例如,如果顯示物件面向正 x 軸,它會持續以 prependTranslation() 方法所指定的方向移動,不論物件的旋轉方式為何。若要讓轉移在其他變形之後發生,請使用 appendTranslation() 方法。

參數

x:Number — 沿著 x 軸的遞增式轉移。
 
y:Number — 沿著 y 軸的遞增式轉移。
 
z:Number — 沿著 z 軸的遞增式轉移。

相關 API 元素


範例  ( 如何使用本範例 )

在這個範例中,使用者可以使用滑鼠,在舞台的 y 軸向上推動橢圓形。當使用者將滑鼠移至橢圓形上方時,橢圓形會在 y 軸向上跳躍十個座標。當滑鼠移開橢圓形時,如果橢圓形尚未到達頂端,橢圓形會在 y 軸再次向上跳躍十個座標。一旦橢圓形到達頂端,它會移回至舞台底端。
package {
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.geom.*;
    import flash.events.MouseEvent;

    public class Matrix3DprependTranslationExample extends MovieClip {
        private var ellipse:Sprite = new Sprite();

        public function Matrix3DprependTranslationExample():void {
            ellipse.x = this.stage.stageWidth / 2;
            ellipse.y = this.stage.stageHeight - 100;
            ellipse.z = 1;
            ellipse.graphics.beginFill(0xFF0000);
            ellipse.graphics.lineStyle(2);
            ellipse.graphics.drawEllipse(0, 0, 60, 50);
            ellipse.graphics.endFill();
            addChild(ellipse);

            ellipse.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
            ellipse.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
        }

        private function mouseOverHandler(e:MouseEvent):void {
            if(ellipse.y > 0) { 
                ellipse.transform.matrix3D.prependTranslation(0, -10, 0);
            } 
        }
        
        private function mouseOutHandler(e:MouseEvent):void {
            if(ellipse.y > 0) { 
                ellipse.transform.matrix3D.prependTranslation(0, -10, 0);
            } else {
                ellipse.transform.matrix3D.prependTranslation(0, 
                                     (this.stage.stageHeight - 100), 0);
            }   
        }
    }
}

recompose

()方法 
public function recompose(components:Vector.<Vector3D>, orientationStyle:String = "eulerAngles"):Boolean

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

設定變形矩陣的轉移、旋轉和縮放設定。不同於顯示物件的旋轉屬性或 Matrix3D 物件的旋轉方法所做的遞增式變更,recompose() 方法所做的變更是絕對變更。recompose() 方法會覆寫矩陣的變形。

若要使用絕對父輩參考座標來修改矩陣的變形,請使用 decompose() 方法擷取設定並進行適當變更。然後,您可以使用 recompose() 方法,將 Matrix3D 物件設定為修改後的變形。

recompose() 方法的參數會指定用於變形的方向樣式。預設方向為 eulerAngles,這會使用每個座標軸的三個獨立旋轉角度來定義方向。旋轉會連續發生,而且不會變更個別旋轉的軸。顯示物件的軸旋轉屬性會執行「尤拉角度」方向樣式變形。其他方向樣式選項為 axisAnglequaternion。軸角度方向會使用座標軸和角度的組合來決定方向。物件旋轉依據的軸是代表方向的單位向量。角度代表向量的旋轉量。方向也會決定顯示物件朝向的位置,而角度決定哪個方向是上方。appendRotation()prependRotation() 方法使用軸角度方向。四元數方向會使用複數和向量的第四個元素。方向是由三個旋轉軸 (x,y,z) 和一個旋轉角度 (w) 表示。interpolate() 方法使用四元數。

參數

components:Vector.<Vector3D> — 包含三個 Vector3D 物件的 Vector,這些 Vector3D 物件會取代 Matrix3D 物件的轉移、旋轉和縮放元素。
 
orientationStyle:String (default = "eulerAngles") — 選擇性的參數,會決定矩陣變形使用的方向樣式。三種方向樣式為 eulerAngles (常數 EULER_ANGLES)、axisAngle (常數 AXIS_ANGLE) 和 quaternion (常數 QUATERNION)。如需有關不同方向樣式的詳細資訊,請參閱 geom.Orientation3D 類別。

傳回值
Boolean — 如果 components Vector 的任何 Vector3D 元素不存在或是 null,則傳回 false

相關 API 元素

transformVector

()方法 
public function transformVector(v:Vector3D):Vector3D

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

使用變形矩陣,將 Vector3D 物件從一個空間座標轉換成另一個空間座標。傳回的 Vector3D 物件會保存變形後的新座標。所有矩陣變形 (包括轉移) 都會套用至此 Vector3D 物件。

如果 transformVector() 方法的結果套用至顯示物件的位置,只有顯示物件的位置會變更。顯示物件的旋轉和縮放元素會保持不變。

注意:這個方法會自動將傳遞之 Vector3D 的 w 元件設定為 1.0。

參數

v:Vector3D — Vector3D 物件,保存即將變形的座標。

傳回值
Vector3D — 具有變形座標的 Vector3D 物件。

相關 API 元素

transformVectors

()方法 
public function transformVectors(vin:Vector.<Number>, vout:Vector.<Number>):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

使用變形矩陣,將數字的 Vector 從一個座標空間轉換成另一個座標空間。tranformVectors() 方法會讀取 vin Vector 物件中的每三個數字做為 3D 座標 (x,y,z),並將變形後的 3D 座標放在 vout Vector 物件中。所有矩陣變形 (包括轉移) 都會套用至此 vin Vector 物件。您可以使用 transformVectors() 方法將 3D 物件顯示及轉換為網格。網格是定義物件形狀的頂點集合。

參數

vin:Vector.<Number> — 數字的 Vector,其中每三個數字是一個即將變形的 3D 座標 (x,y,z)。
 
vout:Vector.<Number> — 數字的 Vector,其中每三個數字是一個 3D 變形座標 (x,y,z)。

相關 API 元素

transpose

()方法 
public function transpose():void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將目前的 Matrix3D 物件轉換成列與欄對調的矩陣。例如,如果目前 Matrix3D 物件的 rawData 包含下列 16 個數字 1,2,3,4,11,12,13,14,21,22,23,24,31,32,33,34transpose() 方法就會讀取每四個元素做為一列,並且將列轉變為欄。結果便會是具有下列數字之 rawData 的矩陣:1,11,21,31,2,12,22,32,3,13,23,33,4,14,24,34

transpose() 方法會將目前矩陣取代為轉置矩陣。如果您要轉置矩陣但不要變更目前矩陣,請先使用 clone() 方法複製目前矩陣,然後將 transpose() 方法套用至副本。

直交矩陣是其轉置等於反轉的正方形矩陣。





[ X ]為什麼顯示英文?
「ActionScript 3.0 參考」的內容是以英文顯示

並非所有「ActionScript 3.0 參考」的內容都翻譯為所有語言。當語言元素未翻譯時,就會以英文顯示。例如,ga.controls.HelpBox 類別並沒有翻譯為任何語言。因此在參考的繁體中文版本中,ga.controls.HelpBox 類別就會以英文顯示。