There is a group of verbs called de afección psíquica ≈‘of psychical act.’
Example (but not exhaustive list) of such verbs (taken from this article):
- afectar
- animar
- asombrar
- asustar
- aterrorizar
- divertir
- emocionar
- entretener
- exaltar
- molestar
- ofender
- preocupar
This type of verbs can take the affected object as either direct or indirect.
We can say that the difference is mostly based on whether there is agency (something/someone acting intentionally) or not. There are two things to consider:
1. What if the subject is animate [which can be an agent].
2. What if the subject is inanimate.
The subject is animate
Let’s consider this example:
1. «Su padre, que se había disfrazado, LO asustó».
2. «Su padre, que se había disfrazado, LE asustó».
- The first sentence shows a clear intention behind the action. The father disguised himself and used this opportunity to scary his son.
- In the second example, it was a coincidence. His father scared him unintentionally. The poor child e.g. didn’t recognize his father and got terrified thinking someone broke in to the house.
This distinction is not common to all the dialects of Spanish and may appear to many people as leísmo, as interpreting the father as the direct object is more natural.
The subject is inanimate
In case of the inanimate subject, the situation is much more universal. The general rule is that the object is direct if the [inanimate!] subject goes before the verb, and indirect in other cases:
1. «Mi apetito LO asombró».
2. «LE asombró mi apetito».
3. «LE asombró que seas capaz de hacerlo sin mirar.»
Notice how in (1) and (2) the object changes just because of the placement. (I guess the subject before the verb is associated with agency, that’s why we say «Creció el arból», «Acaba de sonar el teléfono» etc. with the subject after the verb(??).)
In case of (3), the subject is the whole «que seas capaz […]» clause, which is also inanimate.
Source: leísmo, §4a, DPD