Pendulum (harmonic motion) should start at center

I’m trying to create a harmonic motion effect for a spotlight to let it swing back and forth on its local Y axis.
This generally works fine, but I want the motion to actually start from the center between “_left” and “_right” instead of starting at either of the extremes. Can this be accomplished?

public float rotationSpeed = 1.0f;
public float maxRotation = 35f;

Quaternion _left, _right;
float turnTime;

void Start () {
        turnTime = 0.0f;
        _left = Quaternion.AngleAxis (maxRotation, Vector3.up);
        _right = Quaternion.AngleAxis (-maxRotation, Vector3.up);
 }

void Update () {
        turnTime += Time.deltaTime;
        transform.localRotation = Quaternion.Lerp (_left, _right, (Mathf.Sin (turnTime * rotationSpeed + Mathf.PI / 2) + 1.0f) / 2.0f);
}

Please ask me to elaborate if in doubt about what I mean, and I will try my best.
Thanks in advance.

Well, then just remove your strange 90° offset from your sin calculation ^^. You get the halfway point when the sin method returns 0 which is when the time is 0. Keep in mind that you shift your amplitude up by 1 and then you divide by 2. So when sin returns 0 you add 1 and divide by 2 so you get 0.5.

The top peak of the sine wave would map to a value of 1 while the lowerst point maps to a value of 0. Sine is at its peak at PI/2, 5PI/2, 9PI/2, … It will be on its lowers point at 3PI/2, 7PI/2, … and it will pass through the middle at 0, PI, 2PI, 3PI, …

Of course the sine would have the highest velocity at the middle where the inflection point is located.

I’m not sure what you want to do with the startAngle value. This value does not represent any angle at all. You just grabbed the y component of the quaternion. A quaternion does not represent euler angles but a 4d complex number. In your question you said the absolute rotations _left and _right are correct and you just want to start at the center between them. In that case the “center” has to be the identity rotation. If your question was how to actually let the object swing around a certain initial rotation you failed horrible at explaining this in your description ^^.

So if your left and right extremes are actually not correct and you want them to be “maxRotation” degrees away from the initial rotation you have to do

var initialRotation = transform.rotation;
_left = Quaternion.AngleAxis (maxRotation, Vector3.up) * initialRotation;
_right = Quaternion.AngleAxis (-maxRotation, Vector3.up) * initialRotation;

Of course the 90° offset thing is still the same ^^.