コード例 #1
0
            public void Set(Vector2 p, float fWidth, int iFontSize, AnimationCurve _curve, Action <AnimationCurve> f)
            {
                rect      = new Rect(p.x - fWidth, p.y, fWidth, 0f);
                fRightPos = p.x + fWidth;
                fUpPos    = p.y;

                gsLabel.fontSize  = iFontSize;
                gsButton.fontSize = iFontSize;
                gsText.fontSize   = iFontSize;

                fMargin = iFontSize * 0.3f;

                func = f;

                curve = _curve;

                keys = new Keyframe[_curve.keys.Length];
                for (int i = 0; i < keys.Length; i++)
                {
                    keys[i] = _curve.keys[i];
                }
                keys[0] = _curve.keys[0];
                keys[keys.Length - 1] = _curve.keys[keys.Length - 1];

                fCurve = new float[keys.Length * 2];
                for (int i = 0; i < keys.Length; i++)
                {
                    fCurve[i * 2]     = keys[i].outTangent;
                    fCurve[i * 2 + 1] = keys[i].value;
                }

                sValues[0] = keys[0].outTangent.ToString();
                sValues[1] = keys[0].value.ToString();
                sValues[2] = keys[keys.Length - 1].inTangent.ToString();
                sValues[3] = keys[keys.Length - 1].value.ToString();

                texture = GlobalCurveWindow.CreateCurveTexture(curve, false);

                show    = true;
                changed = true;
            }
コード例 #2
0
 private void CreateCurve()
 {
     curve   = new AnimationCurve(keys);
     texture = GlobalCurveWindow.CreateCurveTexture(curve, false);
 }