How to make an animation of following fractal-like gif by using Mathematica?
$\begingroup$
$\endgroup$
2
-
13$\begingroup$ Have you tried anything? $\endgroup$– Martin EnderCommented Apr 27, 2016 at 8:53
-
3$\begingroup$ Here is the source: dribbble.com/beesandbombs and beesandbombs.tumblr.com, looks like David White uses Processing to make these $\endgroup$– Jason B.Commented Apr 27, 2016 at 10:28
Add a comment
|
2 Answers
$\begingroup$
$\endgroup$
Not as great as the original but should serve as a good starting point. The code should probably be self-explanatory...
(* parameters *)
innerradius = 20;
outerradius = 23;
numvertices = 12;
xrange = {-100, 100};
yrange = {-100, 100};
numframes = 150;
colour = Black;
finalangle = 720 Degree; (* must be a multiple of 360 Degree / numvertices *)
blurring = 10;
halfangleadjust = 14 / 10;
(* secondary stuff *)
middleradius = (outerradius + innerradius) / 2;
enlargementfactor = 2 outerradius / (outerradius - innerradius);
initialcenter = {0, -middleradius * enlargementfactor};
vertices = CirclePoints[
initialcenter,
{middleradius * enlargementfactor, 90 Degree},
numvertices
];
annuli[innerrad_] := Annulus[#, {innerrad, outerradius}] & /@ vertices;
(* transformations *)
translationsteps = Table[{0, middleradius * enlargementfactor} x, {x, 0, 1, 1 / numframes}];
shrinkingsteps = Subdivide[1, 1/enlargementfactor, numframes];
rotationsteps = Table[finalangle * x^4, {x, 0, 1, 1 / numframes}];
ingrowthsteps = Table[innerradius * x^10, {x, 0, 1, 1 / numframes}];
(* faux motion blur *)
opacitysteps = Abs[Abs @ Subdivide[-1, 1, blurring] - 1];
halfanglesteps = Table[halfangleadjust (360 Degree / numvertices / 2) x^5, {x, 0, 1, 1 / numframes}];
(* construction *)
frames = Table[
Module[
{centre, innerrad, blurringsteps, composite},
centre = TranslationTransform[translationsteps[[n]]] @ initialcenter;
innerrad = innerradius - ingrowthsteps[[n]];
blurringsteps = Subdivide[-halfanglesteps[[n]], halfanglesteps[[n]], blurring];
composite = Composition[
Rotate[#, -rotationsteps[[n]], centre] &,
Scale[#, shrinkingsteps[[n]], centre] &,
Translate[#, translationsteps[[n]]] &
] @ annuli[If[innerrad == 0, 1 / 1000, innerrad]];
Graphics[
{MapThread[{Opacity[#1, colour], Rotate[composite, #2, centre]} &, {opacitysteps, blurringsteps}]},
Background -> GrayLevel[95 / 100],
PlotRange -> {xrange, yrange}
]
],
{n, 1, numframes + 1}
];
Then ListAnimate[frames]
gives
$\begingroup$
$\endgroup$
Here's something you can start with,
rinit = 6;
rfactor = 0.05;
rstep = .025;
npoints = Floor[(rinit - rfactor rinit)/rstep];
imglist = Table[
With[{r = rinit - n rstep},
Graphics[{Thickness[.03],
Circle[#, rfactor r]} & /@
CirclePoints[{0, -r + 2 (rinit - npoints rstep)}, {r,
2 π/npoints n}, 40.],
ImageSize -> 300,
PlotRange -> {{-1.1, 1.1}, {-1.1, 1.1}}]],
{n, 0, npoints}];
Manipulate[imglist[[n]], {{n, 1}, 1, Length@imglist, 1}]