This ESP8266 PWM example explains how to use the Pulse Width Modulation (PWM) with the ESP8266.
analogWrite(PIN,VALUE);
ESP8266 can generate PWM on all IO pins. The ESP8266 analogWrite is different than the Arduino Uno. ESP8266 uses 10-bit resolution for PWM generation PWM value varries from 0 to 1023. Arduino Uses 8-Bit Resolution i.e.PWM range is 0-254.