• New Entry

Dream catcher

Jenny Bosten on 31 Oct 2021
  • 14
  • 98
  • 0
  • 0
  • 280
p=@randi; % define a function used multiple times to save characters
a=500; %image dimensions
u=ones(a);%create an image of ones for use later
colormap([bone;parula])%colormap is 512x3, first 256 greyscale, next 256 colour
d=-200:.801:200;% define a vector with which to create polar coordinates, numbers more or less
%arbitrary but must be 500 long (avoided linspace to save characters)
image(u)%present starting black image
Current plot held
for j=1:600 %there are 600 lights (not all are in frame, and some are hidden behind cloud)
%This line creates an exponential radial matrix with which to define
%the lights. the 400*(rand-.5) randomises position of the cente of the
%radial matrix in the y and y directions and determines light position.
%The scalar p(9) determines the size distribution of the lights (larger number,
%larger sizes). The polar radial matrix is in a form suggested by Sebastian Kraemer using
%complex numbers, but cart2pol would be an alternative using e few more
b=r; %Define alpha data around radial function (lights are opaque by degree, background is transparent)
512]; %select light colors from second half of colormap (turbo)
%occurs 4 times from 1:600 but every 140 iterations. I.e. for every 140 lights there is a cloud layer
if rem(j,140)==0
%Create cloud based on inverse Fourier transform (the 7 in cos(7*rand(a))) is a short
%version of 2*pi), which is a short version, to save characters,
% of a method for generating pink noise). An inverse transform of a linear
% radial matrix (recreated from the d-vector) to a small negative
% power (-1.2 to -1.7) then multiplied by the cosine of a random
% matrix.
v=1.4; %This scaling factor makes the clouds denser
f=256;%sets distribution on colormap to select clouds from (bone)
%adds image of light or cloud as an alpha layer rescaled to be between
%0 and 1.
%images look quite different on different runs because the clouds very
%depending on the random matrix put into the ifft, and also the colours selected
% for the clouds. I think most of the images produced look like paint balls stuck in ice!
Remix Tree