Here is an good example of the way Kamma works.
(Preamble: We could give away the puppy that had come back to us. Now, again, there is the mother dog and one puppy. The puppy stays at the terrace of the hut i live in. the roof of this terrace is leaking (a lot) and there is only one spot that remains dry when it's raining. The mother changes places but likes to sleep on the table on the terrace.)
The puppy wakes up between 2h and 3h and starts crying. First it wants to get on the table where the mother is, but she only grunts and walks away. Night before last night the puppy had the idea to keep crying and started scratching at my door. It was raining heavy.
“If i let it come in now, i always wants to come in and it will not learn that the dogs place is outside.” My heart almost broke. But after half an hour constant crying and scratching i thought “a small throw of water will eventually teach the dog that crying is not the way to get what one wants”.
The puppy kept quiet and fell asleep and so did i after watching it for a while with compassion.
Next night, last night it unfortunately had forgotten the lesson. It rained, puppy cried, mother left grunting and I dressed to go out and pull some water. When it heard me, it stopped crying. When i was in bed (well, on my mat) again, puppy started crying anew. I tried grunting, as the mother does, with not much effect, so I dressed up again. when i opened the door, i realized that i was, this time, displeased, somehow a little bit gloating, thinking that i will be tiered next day because one hour sleep will be missing. I through the water, puppy stopped crying and went back to sleep right away.
For me the karma of being malicious worked right away: The entrance door had sucked too much humidity and I couln'd close it anymore. I spend almost an hour to cut some wood off with a little pocketknife, to make the door fit into it's frame again.
Kamma is more the result of what you think then of what you do, of your volition. Respectively: The state of mind, the good or bad intention that one has while acting in a certain way is producing Karma, not so much the act itself.