void SetColor(KoreographyEvent evt, int sampleTime, int sampleDelta, DeltaSlice deltaSlice) { if (evt.HasCurvePayload()) { float curveValue = evt.GetValueOfCurveAtTime(sampleTime); spriteRenderer.color = startColor * (1 - curveValue) + curveValue * targetColor; } }
void SetScale(KoreographyEvent evt, int sampleTime, int sampleDelta, DeltaSlice deltaSlice) { if (evt.HasCurvePayload()) { float curveValue = evt.GetValueOfCurveAtTime(sampleTime); transform.localScale = startScale * (1 - curveValue) + curveValue * targetScale; } }
void SetPosition(KoreographyEvent evt, int sampleTime, int sampleDelta, DeltaSlice deltaSlice) { if (evt.HasCurvePayload()) { float curveValue = evt.GetValueOfCurveAtTime(sampleTime); transform.position = startPosition * (1 - curveValue) + curveValue * endPosition; } }
private void ChangeCube(KoreographyEvent koreoEvent, int sampleTime, int sampleDelta, DeltaSlice deltaSlice) { if (koreoEvent.HasCurvePayload()) { float curveValue = koreoEvent.GetValueOfCurveAtTime(sampleTime); transform.localScale = Vector3.one * Mathf.Lerp(minScale, maxScale, curveValue); } }
void AdjustScale(KoreographyEvent evt, int sampleTime, int sampleDelta, DeltaSlice deltaSlice) { if (evt.HasCurvePayload()) { // Get the value of the curve at the current audio position. This will be a // value between [0, 1] and will be used, below, to interpolate between // minScale and maxScale. float curveValue = evt.GetValueOfCurveAtTime(sampleTime); transform.localScale = Vector3.one * Mathf.Lerp(minScale, maxScale, curveValue); } }
/* void TestPayload(KoreographyEvent evt) * { * print(evt.GetIntValue() + " " + Time.time); * }*/ void TestOffset(KoreographyEvent evt, int sampleTime, int sampleDelta, DeltaSlice deltaSlice) { /*print("OffSet " + Time.time); * print(sampleTime); * print(sampleDelta);*/ if (evt.HasCurvePayload()) { //print("Scale Start"); // Get the value of the curve at the current audio position. This will be a // value between [0, 1] and will be used, below, to interpolate between // minScale and maxScale. float curveValue = Mathf.Clamp(evt.GetValueOfCurveAtTime(sampleTime), 0.5f, 1); print(curveValue); //transform.position = new Vector3(Random.Range(0 , 5), 0, Random.Range(-5 , 0)); //interim = Vector3.one * Mathf.Lerp(minScale, maxScale, curveValue); //interim.y = 1.2f; transform.localScale *= curveValue; } }