mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-20 18:02:38 +08:00
7371e889ad
# [4.0.0-preview.8](https://github.com/mob-sakai/UIEffect/compare/v4.0.0-preview.7...v4.0.0-preview.8) (2020-06-04) ### change * change namespace ([7f4190c](https://github.com/mob-sakai/UIEffect/commit/7f4190c8c6f294e90869767a96194ec5ac4ba57f)) ### Features * modify EffectPlayer at runtime ([8483ba6](https://github.com/mob-sakai/UIEffect/commit/8483ba63cb546ca032915c166c0333fa5fd7aa76)), closes [#214](https://github.com/mob-sakai/UIEffect/issues/214) [#215](https://github.com/mob-sakai/UIEffect/issues/215) ### BREAKING CHANGES * If your code contained the UIEffect API, it would fail to compile. Please change the namespace from to .
34 lines
919 B
C#
34 lines
919 B
C#
using UnityEngine;
|
|
|
|
namespace Coffee.UIEffects
|
|
{
|
|
/// <summary>
|
|
/// Matrix2x3.
|
|
/// </summary>
|
|
public struct Matrix2x3
|
|
{
|
|
public float m00, m01, m02, m10, m11, m12;
|
|
|
|
public Matrix2x3(Rect rect, float cos, float sin)
|
|
{
|
|
const float center = 0.5f;
|
|
float dx = -rect.xMin / rect.width - center;
|
|
float dy = -rect.yMin / rect.height - center;
|
|
m00 = cos / rect.width;
|
|
m01 = -sin / rect.height;
|
|
m02 = dx * cos - dy * sin + center;
|
|
m10 = sin / rect.width;
|
|
m11 = cos / rect.height;
|
|
m12 = dx * sin + dy * cos + center;
|
|
}
|
|
|
|
public static Vector2 operator *(Matrix2x3 m, Vector2 v)
|
|
{
|
|
return new Vector2(
|
|
(m.m00 * v.x) + (m.m01 * v.y) + m.m02,
|
|
(m.m10 * v.x) + (m.m11 * v.y) + m.m12
|
|
);
|
|
}
|
|
}
|
|
}
|