Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DynamicModule[{shapes, t, a, next, keyframes},
- shapes[i_] :=
- Thread@{Table[
- ColorData["BlueGreenYellow"]@Rescale[a, {1, i}], {a, i}],
- Disk /@ First@
- Fold[Module[{pts = #[[1]], r = #[[2]],
- n = #2}, {Join @@
- Table[# + n r Through@{Cos, Sin}[a 2 Pi/n + Pi/2] & /@
- RotationTransform[a 2 Pi/n + If[n == 2, Pi/2, 0]]@
- pts, {a, n}], n r}] &, {{{0., 0.}}, 1},
- Join @@ ConstantArray @@@ FactorInteger@i]};
- t = 1;
- a = 1;
- next[] :=
- keyframes =
- Thread[{Prepend[#, #[[1]]], #2} & @@ (shapes /@ {a, a + 1})];
- next[];
- Dynamic[If[(t += .02) >= a + 1, a++; next[]];
- Graphics[{Blend[{#[[1]], #2[[1]]}, t - a],
- Disk[#[[2, 1]] + (t - a) (#2[[2, 1]] - #[[2, 1]])]} & @@@
- keyframes, PlotRange -> t*{{-2, 2}, {-2, 2}}, AspectRatio -> 1,
- ImageSize -> 300]]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement