Optimization of nanocapsules preparation by the emulsion–diffusion method for food applications