fade in led problem

What happens is that the PWM can be set to 0-255. If you pass a larger value to analogWrite() it overflows. So analogWrite(led1, 256) is the same as analogWrite(led1, 0)
analogWrite(led1, 384) is the same as analogWrite(led1, 128)
analogWrite(led1, 511) is the same as analogWrite(led1, 255)

If you make brightness1 a byte instead of an int the output will match your expected LED brightness because byte overflows to 0 after 255, just like the PWM.