private void ReadCurve(Stream input, int frameIndex, CurveTimeline timeline) { switch (input.ReadByte()) { case CURVE_STEPPED: timeline.SetStepped(frameIndex); break; case CURVE_BEZIER: timeline.SetCurve(frameIndex, ReadFloat(input), ReadFloat(input), ReadFloat(input), ReadFloat(input)); break; } }
static void ReadCurve(Dictionary <String, Object> valueMap, CurveTimeline timeline, int frameIndex) { if (!valueMap.ContainsKey("curve")) { return; } Object curveObject = valueMap["curve"]; if (curveObject.Equals("stepped")) { timeline.SetStepped(frameIndex); } else { var curve = curveObject as List <Object>; if (curve != null) { timeline.SetCurve(frameIndex, (float)curve[0], (float)curve[1], (float)curve[2], (float)curve[3]); } } }
void setCurve(CurveTimeline timeline, int frameIndex, float cx1, float cy1, float cx2, float cy2) { timeline.SetCurve(frameIndex, cx1, cy1, cx2, cy2); }
private void ReadAnimationCurve(CurveTimeline timeline, int keyframeIndex, JToken valueMap) { JToken curveObject = valueMap["curve"]; if (curveObject == null) { return; } if (curveObject is JArray) { var curve = (JArray) curveObject; timeline.SetCurve(keyframeIndex, (float) curve[0], (float) curve[1], (float) curve[2], (float) curve[3]); } else if (curveObject.Value<string>().Equals("stepped")) { timeline.SetStepped(keyframeIndex); } }