Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
849ee183
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
849ee183
编写于
9月 01, 2022
作者:
T
tianyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
uodate marrix4
Signed-off-by:
N
tianyu
<
tianyu55@h-partners.com
>
上级
075a5c7e
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
83 addition
and
83 deletion
+83
-83
zh-cn/application-dev/reference/arkui-ts/ts-matrix-transformation.md
...cation-dev/reference/arkui-ts/ts-matrix-transformation.md
+83
-83
未找到文件。
zh-cn/application-dev/reference/arkui-ts/ts-matrix-transformation.md
浏览文件 @
849ee183
...
...
@@ -6,7 +6,7 @@
## 导入模块
```
```
ts
import
matrix4
from
'
@ohos.matrix4
'
```
...
...
@@ -55,10 +55,10 @@ Matrix的构造函数,可以通过传入的参数创建一个四阶矩阵,
| m33 | number | 是 | 齐次坐标下生效,产生透视投影效果。 |
-
示例
```
import
M
atrix4 from '@ohos.matrix4'
```
ts
import
m
atrix4
from
'
@ohos.matrix4
'
// 创建一个四阶矩阵
let matrix =
M
atrix4.init([1.0, 0.0, 0.0, 0.0,
let
matrix
=
m
atrix4
.
init
([
1.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
])
...
...
@@ -79,9 +79,9 @@ Matrix的初始化函数,可以返回一个单位矩阵对象。
| Object | 单位矩阵对象。 |
-
示例
```
```
ts
// matrix1 和 matrix2 效果一致
import
M
atrix4 from '@ohos.matrix4'
import
m
atrix4
from
'
@ohos.matrix4
'
let
matrix
=
Matrix4
.
init
([
1.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
...
...
@@ -104,12 +104,12 @@ Matrix的拷贝函数,可以拷贝一份当前的矩阵对象。
| Object | 当前矩阵的拷贝对象。 |
-
示例
```
import
M
atrix4 from '@ohos.matrix4'
```
ts
import
m
atrix4
from
'
@ohos.matrix4
'
@
Entry
@
Component
struct
Test
{
private matrix1 =
M
atrix4.identity().translate({x:100})
private
matrix1
=
m
atrix4
.
identity
().
translate
({
x
:
100
})
private
matrix2
=
this
.
matrix1
.
copy
().
scale
({
x
:
2
})
build
()
{
Column
()
{
...
...
@@ -152,13 +152,13 @@ Matrix的叠加函数,可以将两个矩阵的效果叠加起来生成一个
| Object | 矩阵叠加后的对象。 |
-
示例
```
import
M
atrix4 from '@ohos.matrix4'
```
ts
import
m
atrix4
from
'
@ohos.matrix4
'
@
Entry
@
Component
struct
Test
{
private matrix1 =
M
atrix4.identity().translate({x:200}).copy()
private matrix2 =
M
atrix4.identity().scale({x:2}).copy()
private
matrix1
=
m
atrix4
.
identity
().
translate
({
x
:
200
}).
copy
()
private
matrix2
=
m
atrix4
.
identity
().
scale
({
x
:
2
}).
copy
()
build
()
{
Column
()
{
// 先平移x轴100px,再缩放两倍x轴
...
...
@@ -188,8 +188,8 @@ Matrix的逆函数,可以返回一个当前矩阵对象的逆矩阵,即效
| Object | 当前矩阵的逆矩阵对象。 |
-
示例
```
import
M
atrix4 from '@ohos.matrix4'
```
ts
import
m
atrix4
from
'
@ohos.matrix4
'
// matrix1(宽放大2倍) 和 matrix2(宽缩小2倍) 效果相反
let
matrix1
=
Matrix4
.
identity
().
scale
({
x
:
2
})
let
matrix2
=
matrix1
.
copy
().
invert
()
...
...
@@ -218,12 +218,12 @@ Matrix的平移函数,可以为当前矩阵增加x轴/Y轴/Z轴平移效果。
| Object | 增加好平移效果后的矩阵对象。 |
-
示例
```
import
M
atrix4 from '@ohos.matrix4'
```
ts
import
m
atrix4
from
'
@ohos.matrix4
'
@
Entry
@
Component
struct
Test
{
private matrix1 =
M
atrix4.identity().translate({x:100, y:200, z:30})
private
matrix1
=
m
atrix4
.
identity
().
translate
({
x
:
100
,
y
:
200
,
z
:
30
})
build
()
{
Column
()
{
Image
(
$r
(
"
app.media.bg1
"
)).
transform
(
this
.
matrix1
)
...
...
@@ -261,12 +261,12 @@ Matrix的缩放函数,可以为当前矩阵增加x轴/Y轴/Z轴缩放效果。
| Object | 增加好缩放效果后的矩阵对象。 |
-
示例
```
import
M
atrix4 from '@ohos.matrix4'
```
ts
import
m
atrix4
from
'
@ohos.matrix4
'
@
Entry
@
Component
struct
Test
{
private matrix1 =
M
atrix4.identity().scale({x:2, y:3, z:4, centerX:50, centerY:50})
private
matrix1
=
m
atrix4
.
identity
().
scale
({
x
:
2
,
y
:
3
,
z
:
4
,
centerX
:
50
,
centerY
:
50
})
build
()
{
Column
()
{
Image
(
$r
(
"
app.media.bg1
"
)).
transform
(
this
.
matrix1
)
...
...
@@ -305,12 +305,12 @@ Matrix的旋转函数,可以为当前矩阵增加x轴/Y轴/Z轴旋转效果。
| Object | 增加好旋转效果后的矩阵对象。 |
-
示例
```
import
M
atrix4 from '@ohos.matrix4'
```
ts
import
m
atrix4
from
'
@ohos.matrix4
'
@
Entry
@
Component
struct
Test
{
private matrix1 =
M
atrix4.identity().rotate({x:1, y:1, z:2, angle:30})
private
matrix1
=
m
atrix4
.
identity
().
rotate
({
x
:
1
,
y
:
1
,
z
:
2
,
angle
:
30
})
build
()
{
Column
()
{
Image
(
$r
(
"
app.media.bg1
"
)).
transform
(
this
.
matrix1
)
...
...
@@ -344,14 +344,14 @@ Matrix的坐标点转换函数,可以将当前的变换效果作用到一个
| Point | 返回矩阵变换后的Point对象。 |
-
示例
```
import
M
atrix4 from '@ohos.matrix4'
```
ts
import
m
atrix4
from
'
@ohos.matrix4
'
import
prompt
from
'
@system.prompt
'
@
Entry
@
Component
struct
Test
{
private matrix1 =
M
atrix4.identity().transformPoint([100, 10])
private
matrix1
=
m
atrix4
.
identity
().
transformPoint
([
100
,
10
])
build
()
{
Column
()
{
Button
(
"
get Point
"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录