暂存:动画曲线
还没搞完,复制粘贴也没有
This commit is contained in:
@@ -14,10 +14,12 @@ public class EventPoint : MonoBehaviour
|
||||
public Image EvDrawimage;
|
||||
public Image OvDrawimage;
|
||||
|
||||
|
||||
public RectTransform LeftSide;
|
||||
public RectTransform RightSide;
|
||||
public Button selectButton;
|
||||
|
||||
public RawImage CurveCanvas;
|
||||
public RawImage CurveCanvas2;
|
||||
public FlexibleFloatTab FatherTab;
|
||||
public int BeatDeviver => FatherTab.BeatDeviver;
|
||||
public void Initialize(AnimatedFloat animatedFloat)
|
||||
@@ -29,19 +31,42 @@ public class EventPoint : MonoBehaviour
|
||||
RightSide.localPosition = new Vector3(
|
||||
(animatedFloat.endTime - animatedFloat.startTime) / EditorManager.instance.timeline.timePerBeat * BeatDeviver, 0, 0);
|
||||
|
||||
EvDrawimage.rectTransform.sizeDelta = new Vector2(RightSide.localPosition.x - transform.localPosition.x, EvDrawimage.rectTransform.sizeDelta.y);
|
||||
EvDrawimage.rectTransform.sizeDelta = new Vector2(RightSide.localPosition.x - LeftSide.localPosition.x, EvDrawimage.rectTransform.sizeDelta.y);
|
||||
EvDrawimage.transform.localPosition = new Vector3(EvDrawimage.rectTransform.sizeDelta.x / 2, 0, 0);
|
||||
OvDrawimage.transform.localPosition = RightSide.localPosition;
|
||||
CurveCanvas.transform.localPosition = EvDrawimage.transform.localPosition;
|
||||
CurveCanvas.rectTransform.sizeDelta = new Vector2(EvDrawimage.rectTransform.sizeDelta.x, EvDrawimage.rectTransform.sizeDelta.y + 50);
|
||||
|
||||
|
||||
|
||||
ReDraw();
|
||||
//记得
|
||||
CurveCanvas2.rectTransform.sizeDelta = new Vector2(NextEventPoint.transform.localPosition.x - RightSide.sizeDelta.x, EvDrawimage.rectTransform.sizeDelta.y + 50);
|
||||
|
||||
ReDraw(FatherTab.scalevalue);
|
||||
}
|
||||
|
||||
private void ReDraw()
|
||||
public void ReDraw(float value)
|
||||
{
|
||||
|
||||
|
||||
Texture2D Texture = new Texture2D((int)CurveCanvas.rectTransform.sizeDelta.x / 5, (int)CurveCanvas.rectTransform.sizeDelta.y / 5);
|
||||
for (int i = 0; i < Texture.width; i++)
|
||||
{
|
||||
for (int j = 0; j < Texture.height; j++)
|
||||
{
|
||||
Texture.SetPixel(i, j, new Color(0, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
Texture.Apply();
|
||||
for (int i = 0; i < Texture.width; i++)
|
||||
{
|
||||
float t = (float)i / Texture.width;
|
||||
Texture.SetPixel(i,
|
||||
(int)(
|
||||
(Texture.height / 2) + ((animatedFloat.endValue - animatedFloat.startValue)
|
||||
* AnimationCurveEvaluator.Evaluate(animatedFloat.animationCurveType, t) * value)
|
||||
), Color.green);//丑陋
|
||||
}
|
||||
Texture.Apply();
|
||||
CurveCanvas.texture = Texture;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user