未验证 提交 0d4245c2 编写于 作者: O openharmony_ci 提交者: Gitee

!9015 更新矩阵变换的导入方式

Merge pull request !9015 from 田雨/master
...@@ -58,9 +58,9 @@ Matrix的构造函数,可以通过传入的参数创建一个四阶矩阵, ...@@ -58,9 +58,9 @@ Matrix的构造函数,可以通过传入的参数创建一个四阶矩阵,
- 示例 - 示例
```ts ```ts
import Matrix4 from '@ohos.matrix4' import matrix4 from '@ohos.matrix4'
// 创建一个四阶矩阵 // 创建一个四阶矩阵
let matrix = Matrix4.init([1.0, 0.0, 0.0, 0.0, let matrix = matrix4.init([1.0, 0.0, 0.0, 0.0,
0.0, 1.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, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0]) 0.0, 0.0, 0.0, 1.0])
...@@ -83,12 +83,12 @@ Matrix的初始化函数,可以返回一个单位矩阵对象。 ...@@ -83,12 +83,12 @@ Matrix的初始化函数,可以返回一个单位矩阵对象。
- 示例 - 示例
```ts ```ts
// matrix1 和 matrix2 效果一致 // matrix1 和 matrix2 效果一致
import Matrix4 from '@ohos.matrix4' import matrix4 from '@ohos.matrix4'
let matrix = Matrix4.init([1.0, 0.0, 0.0, 0.0, let matrix = matrix4.init([1.0, 0.0, 0.0, 0.0,
0.0, 1.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, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0]) 0.0, 0.0, 0.0, 1.0])
let matrix2 = Matrix4.identity() let matrix2 = matrix4.identity()
``` ```
...@@ -108,11 +108,11 @@ Matrix的拷贝函数,可以拷贝一份当前的矩阵对象。 ...@@ -108,11 +108,11 @@ Matrix的拷贝函数,可以拷贝一份当前的矩阵对象。
- 示例 - 示例
```ts ```ts
// xxx.ets // xxx.ets
import Matrix4 from '@ohos.matrix4' import matrix4 from '@ohos.matrix4'
@Entry @Entry
@Component @Component
struct Test { struct Test {
private matrix1 = Matrix4.identity().translate({x:100}) private matrix1 = matrix4.identity().translate({x:100})
private matrix2 = this.matrix1.copy().scale({x:2}) private matrix2 = this.matrix1.copy().scale({x:2})
build() { build() {
...@@ -158,12 +158,12 @@ Matrix的叠加函数,可以将两个矩阵的效果叠加起来生成一个 ...@@ -158,12 +158,12 @@ Matrix的叠加函数,可以将两个矩阵的效果叠加起来生成一个
- 示例 - 示例
```ts ```ts
// xxx.ets // xxx.ets
import Matrix4 from '@ohos.matrix4' import matrix4 from '@ohos.matrix4'
@Entry @Entry
@Component @Component
struct Test { struct Test {
private matrix1 = Matrix4.identity().translate({x:200}).copy() private matrix1 = matrix4.identity().translate({x:200}).copy()
private matrix2 = Matrix4.identity().scale({x:2}).copy() private matrix2 = matrix4.identity().scale({x:2}).copy()
build() { build() {
Column() { Column() {
...@@ -195,9 +195,9 @@ Matrix的逆函数,可以返回一个当前矩阵对象的逆矩阵,即效 ...@@ -195,9 +195,9 @@ Matrix的逆函数,可以返回一个当前矩阵对象的逆矩阵,即效
- 示例 - 示例
```ts ```ts
import Matrix4 from '@ohos.matrix4' import matrix4 from '@ohos.matrix4'
// matrix1(宽放大2倍) 和 matrix2(宽缩小2倍) 效果相反 // matrix1(宽放大2倍) 和 matrix2(宽缩小2倍) 效果相反
let matrix1 = Matrix4.identity().scale({x:2}) let matrix1 = matrix4.identity().scale({x:2})
let matrix2 = matrix1.copy().invert() let matrix2 = matrix1.copy().invert()
``` ```
...@@ -226,11 +226,11 @@ Matrix的平移函数,可以为当前矩阵增加x轴/Y轴/Z轴平移效果。 ...@@ -226,11 +226,11 @@ Matrix的平移函数,可以为当前矩阵增加x轴/Y轴/Z轴平移效果。
- 示例 - 示例
```ts ```ts
// xxx.ets // xxx.ets
import Matrix4 from '@ohos.matrix4' import matrix4 from '@ohos.matrix4'
@Entry @Entry
@Component @Component
struct Test { struct Test {
private matrix1 = Matrix4.identity().translate({x:100, y:200, z:30}) private matrix1 = matrix4.identity().translate({x:100, y:200, z:30})
build() { build() {
Column() { Column() {
...@@ -271,11 +271,11 @@ Matrix的缩放函数,可以为当前矩阵增加x轴/Y轴/Z轴缩放效果。 ...@@ -271,11 +271,11 @@ Matrix的缩放函数,可以为当前矩阵增加x轴/Y轴/Z轴缩放效果。
- 示例 - 示例
```ts ```ts
// xxx.ets // xxx.ets
import Matrix4 from '@ohos.matrix4' import matrix4 from '@ohos.matrix4'
@Entry @Entry
@Component @Component
struct Test { struct Test {
private matrix1 = Matrix4.identity().scale({x:2, y:3, z:4, centerX:50, centerY:50}) private matrix1 = matrix4.identity().scale({x:2, y:3, z:4, centerX:50, centerY:50})
build() { build() {
Column() { Column() {
...@@ -317,11 +317,11 @@ Matrix的旋转函数,可以为当前矩阵增加x轴/Y轴/Z轴旋转效果。 ...@@ -317,11 +317,11 @@ Matrix的旋转函数,可以为当前矩阵增加x轴/Y轴/Z轴旋转效果。
- 示例 - 示例
```ts ```ts
// xxx.ets // xxx.ets
import Matrix4 from '@ohos.matrix4' import matrix4 from '@ohos.matrix4'
@Entry @Entry
@Component @Component
struct Test { struct Test {
private matrix1 = Matrix4.identity().rotate({x:1, y:1, z:2, angle:30}) private matrix1 = matrix4.identity().rotate({x:1, y:1, z:2, angle:30})
build() { build() {
Column() { Column() {
...@@ -358,13 +358,13 @@ Matrix的坐标点转换函数,可以将当前的变换效果作用到一个 ...@@ -358,13 +358,13 @@ Matrix的坐标点转换函数,可以将当前的变换效果作用到一个
- 示例 - 示例
```ts ```ts
// xxx.ets // xxx.ets
import Matrix4 from '@ohos.matrix4' import matrix4 from '@ohos.matrix4'
import prompt from '@system.prompt' import prompt from '@system.prompt'
@Entry @Entry
@Component @Component
struct Test { struct Test {
private matrix1 = Matrix4.identity().transformPoint([100, 10]) private matrix1 = matrix4.identity().transformPoint([100, 10])
build() { build() {
Column() { Column() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册