A 2D sand simulator in 424 bytes.
Use mouse to drop more sand.
<canvas id=a><script>d=[f=c=a.getContext`2d`],setInterval((e=>{for(a.width^=0,i=150;i--;) for(d[i]||=[],j=300;j--;)f&&(d[i][j]=(r=Math.random)()<.2),i<149&&d[i][j]&&(o=2,n=[d[i+1][j-1], d[i+1][j],d[i+1][j+1]],n[1]?n[0]&&!n[2]?o=1:n[2]&&!n[0]?o=-1:n[0]||n[2]||(o=r()<.5?1:-1):o=0,o< 2?(d[i+1][j+o]=1,c.fillRect(j+o,i+1,1,1),d[i][j]=0):c.fillRect(j,i,1,1));f=0,d[E.pageY-8][E. pageX-8]=1}),16),onmousemove=i=>E=i</script>