Let's use an example:
You buy 10 machines for 100k, and those machines produce products sold for a total of 10k/year in profit (ignoring labor/electricity/sales costs etc).
If the typical investor requires a rate of return of 10% on this business, your company would be worth 100k. In investing terms, you would have a PE ratio of 10. The immediately-required return will be lower if substantially greater returns are expected in the future (expected growth), and the immediately required return will be higher if your business is expected to shrink.
If at the end of the year you take your 10k and purchase another machine, your valuation will rise to 110k, because you can now produce 11k in earnings per year. If your business has issued 10,000 shares, your share price will rise from $10 to $11. Note that you did not just put cash in the bank, and that you now have a higher share price.
At the end of year 2, with 11 machines, lets imagine that customer demand has fallen and you are forced to cut prices. You somehow produce only 10k in profit, instead of the anticipated 11k. Investors believe this 10k in annual profit will continue into the forseable future. The investor who requires 10% return would then only value your company at 100k, and your share price would fall back from $11 to $10. If your earnings had fallen even further to 9k, they might value you at 90k (9k/0.1=$90k). You still have the same machines, but the market has changed in a way that make those machines less valuable.
If you've gone from earning 10k in year one with 10 machines to 9k in year two with 11 machines, an investor might assume you'll make even less in year three, potentially only 8k, so the value of your company might even fall to 80k or lower. Once it is assumed that your earnings will continue to shrink, an investor might value your business based on a higher required rate of return (e.g. maybe 20% instead of 10%), which would cause your share price to fall even further.