LTSpice capacitance dependend on voltage source
The behavioural elements include, besides the voltage and current, resistor, inductor, and capacitor. If you ran a quick search through the manual you would have found out quicker than it would have taken you to ask here: LTspice > Circuit Elements > C, bottom. Simply place a capacitor and add Q=&lt;...&gt; as the value. If the formula includes x, that signifies a derivative of the current, so your expression needs to be integrated first -- unless you don't need x, it can be done, for example external voltage, in your case.

So, for example, if you want your capacitance to vary according to \$\sin x\$, then you have to integrate that first, which gives you \$-cos x\$:



See the expression is -cos(x), whre x is the derivative of the current. The driving voltage is a unity ramp, which means the current through the capacitor is directly its value (I(C1)). The behavioural voltage is for confirmation, V(test), which shows the same sine. Here, for reasons of clarity, I avoided dividing by 2\$\pi\$, so that the current has a different amplitude; had I not, the current and the voltage would have overlapped and it would not have been clear.



Being a behavioural element, it is dependent on time and its effects, in LTspice, in addition to the derivative of the current you risk getting a lot of noise, so be careful what you wish for.