"ignoring singular matrix" Console Message

I have a view where tapping text uses .scaleEffect to make the text disappear and reappear. An example follows:

struct ContentView: View {
    @State var textScaleFactor: CGFloat = 1.0

    var body: some View {
        Text("Hello, world!")
            .font(.title)   // Makes text easier to tap.
            .padding()
            .scaleEffect(textScaleFactor)
            .animation(.linear(duration: 0.25), value: textScaleFactor)
            .onTapGesture {
                textScaleFactor = textScaleFactor == 1.0 ? CGFloat.zero : 1.0
            }
    }
}

Tapping the text to make it disappear causes the following message to appear in the console:

ignoring singular matrix: ProjectionTransform(m11: 5e-324, m12: 0.0, m13: 0.0, m21: 0.0, m22: 5e-324, m23: 0.0, m31: 81.66666666666666, m32: 31.0, m33: 1.0)

ignoring singular matrix: ProjectionTransform(m11: 5e-324, m12: 0.0, m13: 0.0, m21: 0.0, m22: 5e-324, m23: 0.0, m31: 81.66666666666666, m32: 31.0, m33: 1.0)

Does anybody know what this means? One website says that the message is "a warning", but a warning of what?

Accepted Answer

The transformation matrix is singular when the scale factor is zero, as it will be at the end of your animation. You may be able to ignore it, or maybe don’t scale all the way to zero.

I use 0.001 instead of 0 or .leastNonzeroMagnitude because it fixes the log statement: "ignoring singular matrix: ProjectionTransform..." 0.001 is close enough to zero that the scale looks like it is zero, but actually it is just too small to see. .leastNonzeroMagnitude is interpreted as zero by the transform, I'm guessing.

"ignoring singular matrix" Console Message
 
 
Q