浏览代码

update rotateZ

/main
siyao 4 年前
当前提交
9b2408a6
共有 2 个文件被更改,包括 26 次插入3 次删除
  1. 4
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/Widgets.cs
  2. 25
      com.unity.uiwidgets/Runtime/ui/Matrix4.cs

4
Samples/UIWidgetsSamples_2019_4/Assets/Editor/Widgets.cs


var mediaQueryData = MediaQuery.of(context);
var px = mediaQueryData.size.width / 2;
var py = mediaQueryData.size.width / 2;
var transform = new Matrix4().translationValues(px, py, 0);
transform.rotateZ(Mathf.PI / 180 * 5);
transform: transform,
transform: new Matrix4().rotationZ(Mathf.PI / 180 * 5, px, py),
child:
new Column(
children: new List<Widget> {

25
com.unity.uiwidgets/Runtime/ui/Matrix4.cs


this.setRotationZ(radians);
return this;
}
public Matrix4 rotationZ(float radians, float px, float py) {
this._m4storage[15] = 1.0f;
this.setRotationZ(radians, px, py);
return this;
}
public Matrix4 diagonal3Values(float x, float y, float z) {
this._m4storage[15] = 1;

this._m4storage[3] = 0;
this._m4storage[7] = 0;
this._m4storage[11] = 0;
}
void setRotationZ(float radians, float px, float py) {
float c = Mathf.Cos(radians);
float s = Mathf.Sin(radians);
this._m4storage[0] = c;
this._m4storage[1] = s;
this._m4storage[2] = 0;
this._m4storage[4] = -s;
this._m4storage[5] = c;
this._m4storage[6] = 0;
this._m4storage[8] = 0;
this._m4storage[9] = 0;
this._m4storage[10] = 1.0f;
this._m4storage[3] = 0;
this._m4storage[7] = 0;
this._m4storage[11] = 0;
this._m4storage[12] = s * py + (1 - c) * px;
this._m4storage[13] = -s * px + (1 - c) * py;
}
public float invert() => this.copyInverse(this);

正在加载...
取消
保存