void DimmerAnimation(MovingLight light, float time) { switch (DimmerAnimationMode) { case DimmerAnimationMode.Beat: light.SetIntensity(beat); break; case DimmerAnimationMode.BeatReverse: light.SetIntensity(1 - beat); break; case DimmerAnimationMode.Run: light.SetIntensity(light.GetAddressOffset(AddressType) >= beat - 0.1 ? 1f : 0f); break; case DimmerAnimationMode.RunReverse: light.SetIntensity(light.GetAddressOffset(AddressType) >= beat - 0.1 ? 0f : 1f); break; case DimmerAnimationMode.On: light.SetIntensity(1f); break; case DimmerAnimationMode.Off: light.SetIntensity(0f); break; case DimmerAnimationMode.Sin: light.SetIntensity(0.5f * Mathf.Sin(light.GetAddressOffset(AddressType) * OffsetStrength + time * Speed) + 0.5f); break; case DimmerAnimationMode.ReverseSin: light.SetIntensity(0.5f * Mathf.Sin(light.GetAddressOffset(AddressType) * OffsetStrength - time * Speed) + 0.5f); break; default: light.SetIntensity(1f); break; } light.MultiplyIntensity(IntensityMultiplier); }
void MotionAnimation(MovingLight light, float time) { switch (MotionAnimationMode) { case MotionAnimationMode.Focus: if (Target != null) { light.LookAt(Target.position); } break; case MotionAnimationMode.PanLoop: light.SetPanAngle(panRange.Sin(time)); light.SetTiltDefaltAngle(); break; case MotionAnimationMode.TiltLoop: light.SetTiltAngle(tiltRange.Sin(time)); light.SetPanDefaultAngle(); break; case MotionAnimationMode.OffsetTiltLoop: light.SetTiltAngle( tiltRange.Sin(time * Speed + light.GetAddressOffset(AddressType) * OffsetStrength)); light.SetPanDefaultAngle(); break; case MotionAnimationMode.PanTiltLoop: light.SetPanAngle(panRange.Cos(time)); light.SetTiltAngle(tiltRange.Sin(time)); break; case MotionAnimationMode.OffsetPanTiltLoop: light.SetPanAngle( panRange.Cos(time * Speed + light.GetAddressOffset(AddressType) * OffsetStrength)); light.SetTiltAngle( tiltRange.Sin(time * Speed + light.GetAddressOffset(AddressType) * OffsetStrength)); break; case MotionAnimationMode.Default: light.SetPanDefaultAngle(); light.SetTiltDefaltAngle(); break; } }
void ColorAnimation(MovingLight light, float time) { switch (ColorAnimationMode) { case ColorAnimationMode.Gradient: light.SetColor(LightGradient.Evaluate(light.GetAddressOffset(AddressType))); break; case ColorAnimationMode.GradientLoop: light.SetColor(LightGradient.Evaluate((time + light.GetAddressOffset(AddressType)) % 1f)); break; case ColorAnimationMode.HSVLoop: light.SetColor(Color.HSVToRGB((time + light.GetAddressOffset(AddressType)) % 1f, Saturation, 1)); break; case ColorAnimationMode.HSV: light.SetColor(Color.HSVToRGB(light.GetAddressOffset(AddressType), Saturation, 1)); break; case ColorAnimationMode.RGB: if (light.GetAddressOffset(AddressType) < 1f / 3f) { light.SetColor(Color.red); } else if (light.GetAddressOffset(AddressType) < 2f / 3f) { light.SetColor(Color.green); } else { light.SetColor(Color.blue); } break; default: break; } }