What confuses me about the capacitor's current waveform is how capacitor knows when to start discharging to help maintain a constant output current. In comparison, inductor's current waveform in much easier to understand; it simply charges when the switching is on and discharges when the switch is off.

What confuses me about the capacitor's voltage waveform is that it seems to have no correlation with its current waveform. With inductor, I know v=L(di/dt), so voltage is the slope of the current waveforms. But with capacitor, when I zoom in, current does seems to be the slope of the voltage waveform like i=C(dv/dt) suggests.