下雪的動畫模擬

ARM 285瀏覽

下雪了

代碼:

Clear["`*"]
flake := Module[{arm},
   arm = Accumulate[{{0, 0.1}}~Join~RandomReal[{-1, 1}, {5, 2}]];
   arm = [email protected][{arm[[-1]], {0, 1}}];
   arm = [email protected][arm.{{-1, 0}, {0, 1}}];
   Polygon[Flatten[arm.RotationMatrix[# [Pi]/3] & /@ Range[6], 1]]];

snowfield[flakesize_, size_, num_] :=
  Module[{x = 100/flakesize},
   [email protected]
    Image[Graphics[{White,
       Table[Translate[
         Rotate[flake, RandomReal[{0, [Pi]/6}]], {RandomReal[{0, x}],
           RandomReal[{0, 5 x}]}], {num}]}, Background -> Blue,
      PlotRange -> {{0, x}, {0, 5 x}}], ImageSize -> {size, 5 size}]];

size = 250;

r = snowfield @@@ {{1, size, 500}, {1.5, size, 250}, {2, size, 50}};
Dynamic[Image[(r[[#]] = RotateRight[r[[#]], #]) & /@ {1, 2, 3};
  Total[r[[All, ;; size]]]]]

URL:?點擊打開鏈接

七星彩走势图2元网官网