analogWrite not functioning in if statement

Eh. The only reason the sensor has a delay is so that it won't jump several numbers ahead when you pass your hand over it. It looks alright when the fade is relatively slow, so I think it's alright. Thank you for your help. :open_mouth: