• Remix
  • Share
  • New Entry

  • VMM

  • /
  • Flowing squiggles

on 1 Dec 2023
  • 7
  • 29
  • 0
  • 1
  • 931
function drawframe(nn)
function img = makeCircle(img, center, radius, value)
[x, y] = meshgrid(1:size(img,1), 1:size(img,2));
img((x - center(1)).^2 + (y - center(2)).^2 <= radius.^2) = value;
end
function lap = lapl(x,dist)
lap = (circshift(x,1,1)+circshift(x,-1,1)+circshift(x,1,2)+circshift(x,-1,2)-4*x)/dist^2;
end
range = ceil(linspace(0,512,48));
persistent caps;
if(isempty(caps))
caps = {};
imgsz=512;
textImage = zeros(imgsz);
textImage = insertText(textImage, [80 130], ['MATLAB' newline '40 years'], 'FontSize', 72, 'BoxOpacity',0, 'FontColor','white');
textImage=rgb2gray(textImage);
se = strel('disk', 4);
textImage = imdilate(textImage, se);
u = 1-textImage;
v = textImage;
ru = 0.23;
rv = 0.1;
f = 0.0990;
k = 0.057;
Ts = 0.9078947368;
steps = 60000;
capsstep = floor(steps/24);
for i=1:steps
nu = ru*lapl(u,1)-u.*(v.^2)+f*(1-u);
nv = rv*lapl(v,1)+u.*(v.^2)-v*(f+k);
u = u+Ts*nu;
v = v+Ts*nv;
end
caps = {u};
end
im = circshift(caps{end},range(nn),2);
im = imbinarize(im,0.5);
imshow(im, [])
colormap hot
end
Animation
Remix Tree