AnalogClockAnimation2_3hands_1h_in_4min.gif(115 × 115 εικονοστοιχεία, μέγεθος αρχείου: 5,16 MB, τύπος MIME: image/gif, κυκλικά επαναλαμβανόμενο, 3.601 καρέ, 4 min 13 s)

Αυτό το αρχείο είναι από το Wikimedia Commons και ενδέχεται να χρησιμοποιείται από άλλα εγχειρήματα. Η περιγραφή στη σελίδα περιγραφής του εκεί, εμφανίζεται παρακάτω.

Σύνοψη

Περιγραφή
Deutsch: Animation einer Analoguhr
English: Animation of an analog clock
Ημερομηνία
Πηγή Έργο αυτού που το ανεβάζει
Δημιουργός Jahobr
άλλες εκδόσεις
GIF ανάπτυξη
InfoField
 
diagram δημιουργήθηκε με MATLAB από Jahobr
Πηγαίος κώδικας
InfoField

MATLAB code

function AnalogClockAnimation2()
% source code that produces a GIF and a SVG
%
% 2017-04-27 Jahobr

%% create figure
figHandle = figure(15674455);
clf
axesHandle = axes;
hold(axesHandle,'on')
set(figHandle, 'Units','pixel');
axis equal;
set(axesHandle,'position',[-0.05 -0.05 1.1 1.1]); % stretch axis bigger as figure, easy way to get rid of ticks [x y width height]
set(figHandle, 'position',[1 1 900 900]); % big start image for antialiasing later [x y width hight]
xlim([-1.2 1.2]);
ylim([-1.2 1.2]);
map = gray(8);
set(figHandle,'GraphicsSmoothing','on') % requires at least version 2014b

angleOffPoints = linspace(0,2*pi,121);
angleOffPoints(end) = angleOffPoints(end)+0.001; % fix small rendereing bug; otherwiese the line is not perfectly closed
[X,Y] = pol2cart(angleOffPoints,1);
plot(X,Y,'LineWidth',10,'color',[0 0 0]) % outer line 

[pathstr,fname] = fileparts(which(mfilename)); % save files under the same name and at file location

for minut = 1:60 % minute marks
    x_y = [0   0;... x
        0.9 0.95]; % y
    x_y = rotateInMinutes(x_y,minut);
    plot(x_y(1,:),x_y(2,:),'LineWidth',8,'color',[0 0 0]) % line 
end

for minut = 5:5:60 % hour marks
    x_y = [0   0;... x
        0.75 0.95]; % y
    x_y = rotateInMinutes(x_y,minut);
    plot(x_y(1,:),x_y(2,:),'LineWidth',12,'color',[0 0 0]) % line 
end

%  hour hand
X_Y_hour = [0 0;... x
    -0.1 0.6]; % y
linW_hour = 20;
h_hour = plot(X_Y_hour(1,:),X_Y_hour(2,:),'-k','LineWidth',linW_hour); %

%  minute hand
X_Y_minu = [0 0;... x
    -0.2 0.94]; % y
linW_minu = 12;
h_minu = plot(X_Y_minu(1,:),X_Y_minu(2,:),'-k','LineWidth',linW_minu); %

% second hand
X_Y_sec = [0 0;... x
    -0.2 0.94];
linW_sec = 8.0;
h_sec = plot(X_Y_sec(1,:),X_Y_sec(2,:),'-k','LineWidth',linW_sec); %


%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2-hands %%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(h_sec,'xData',X_Y_sec(1,:),'yData',X_Y_sec(2,:)+10); % move second hand out

tic

nFrames = 12*60;
for iFrame = 1:nFrames
    minu = iFrame-1;
    
    x_y = rotateInMinutes(X_Y_hour,minu/60*5);
    set(h_hour,'xData',x_y(1,:),'yData',x_y(2,:));
    
    x_y = rotateInMinutes(X_Y_minu,floor(minu));
    set(h_minu,'xData',x_y(1,:),'yData',x_y(2,:));
    
    
    if nFrames == 60*60*12
        set(h_hour,'LineWidth',linW_hour*1.5); % thicker lines for the 12h 3Hands case
        set(h_minu,'LineWidth',linW_minu*1.5); % thicker lines for the 12h 3Hands case
    end

    %% save animation 1 "2 hands" 12-hour
    drawnow;
    f = getframe(figHandle);
    f1 = imresize(f.cdata,250/900); % the size reduction: adds antialiasing
   
    if iFrame == 1 % create variable
        im1 = rgb2ind(f1,map,'nodither');
        im1(1,1,1,nFrames) = 0; % allocate
    else
        im1(:,:,1,iFrame) = rgb2ind(f1,map,'nodither');
    end
    
    imtemp1 = rgb2ind(f1,map,'nodither');
    im1(:,:,1,iFrame) = imtemp1;
    
    
    %% save animation 2  "2 hands" 1-hour
    if minu <= 60 % 61 frames
        if iFrame == 1 % create variable
            im2 = rgb2ind(f.cdata,map,'nodither');
            im2(1,1,1,61) = 0; % allocate
        else
            im2(:,:,1,iFrame) = rgb2ind(f.cdata,map,'nodither');
        end
    end
        

end


imwrite(im1,map,fullfile(pathstr, [fname '_2hands_12h_in_1min.gif']),'DelayTime',1/12,'LoopCount',inf) % (12*60)/12
disp([fname '_2hands_12h_in_1min.gif  has ' num2str(numel(im1)/10^6 ,4) ' Megapixels']) % Category:Animated GIF files exceeding the 50 MP limit
imwrite(im1,map,fullfile(pathstr, [fname '_2hands_12h_in_realtime.gif']),'DelayTime',60,'LoopCount',inf) %
disp([fname '_2hands_12h_in_realtime.gif  has ' num2str(numel(im1)/10^6 ,4) ' Megapixels']) % Category:Animated GIF files exceeding the 50 MP limit

imwrite(im2,map,fullfile(pathstr, [fname '_2hands_1h_in_6sec.gif']),'DelayTime',1/10,'LoopCount',inf) % 60/10
disp([fname '_2hands_1h_in_6sec.gif  has ' num2str(numel(im2)/10^6 ,4) ' Megapixels']) % Category:Animated GIF files exceeding the 50 MP limit
imwrite(im2,map,fullfile(pathstr, [fname '_2hands_1h_in_realtime.gif']),'DelayTime',60,'LoopCount',inf) %
disp([fname '_2hands_1h_in_realtime.gif  has ' num2str(numel(im2)/10^6 ,4) ' Megapixels']) % Category:Animated GIF files exceeding the 50 MP limit

%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3-hands %%%%%%%%%%%%%%%%%%%%%%%%%%%%
if nFrames == 60*12
    msgbox(['Rendering for the full 12-hour-version will take about ' num2str(round(toc*60/60)) ' minutes.']);
end

set(h_hour,'LineWidth',linW_hour*1.5); % thicker lines for the 12h 3Hands case
set(h_minu,'LineWidth',linW_minu*1.5); % thicker lines for the 12h 3Hands case
set(h_sec, 'LineWidth',linW_sec *1.5); % thicker lines for the 12h 3Hands case
        
nFrames = 60*60*12;

for iFrame = 1:nFrames
    secon = iFrame-1;
    
    x_y = rotateInMinutes(X_Y_hour,secon/60/60*5);
    set(h_hour,'xData',x_y(1,:),'yData',x_y(2,:));
    
    x_y = rotateInMinutes(X_Y_minu,floor(secon/60));
    set(h_minu,'xData',x_y(1,:),'yData',x_y(2,:));
    
    x_y = rotateInMinutes(X_Y_sec,secon);
    set(h_sec,'xData',x_y(1,:),'yData',x_y(2,:));

    %% save animation 1 "3 hands" 12-hour
    drawnow;
    f = getframe(figHandle);
    f1 = imresize(f.cdata,34/900); % the size reduction: adds antialiasing
    
    if iFrame == 1 % create variable
        im1 = rgb2ind(f1,map,'nodither');
        im1(1,1,1,nFrames) = 0; % allocate
    else
        im1(:,:,1,iFrame) = rgb2ind(f1,map,'nodither');
    end

       
    %% save animation 2  "3 hands" 1-hour
    if secon <= 60*60 % 3601 frames
        set(h_hour,'LineWidth',linW_hour); % normal lines
        set(h_minu,'LineWidth',linW_minu); % normal lines
        set(h_sec, 'LineWidth',linW_sec ); % normal lines
        
        drawnow;
        f = getframe(figHandle);
        f2 = imresize(f.cdata,115/1000); % the size reduction: adds antialiasing
        
        if iFrame == 27*60+13
            if ~isempty(which('plot2svg'))
                plot2svg(fullfile(pathstr, [fname '_still_frame.svg']),figHandle) % by Juerg Schwizer
            else
                disp('plot2svg.m not available; see http://www.zhinst.com/blogs/schwizer/');
            end
        end
        
        
        if iFrame == 1 % create variable
            im2 = rgb2ind(f2,map,'nodither');
            im2(1,1,1,60*60+1) = 0; % allocate
        else
            im2(:,:,1,iFrame) = rgb2ind(f2,map,'nodither');
        end
        
        set(h_hour,'LineWidth',linW_hour*1.5); % thicker lines for the 12h 3Hands case
        set(h_minu,'LineWidth',linW_minu*1.5); % thicker lines for the 12h 3Hands case
        set(h_sec, 'LineWidth',linW_sec *1.5); % thicker lines for the 12h 3Hands case
    end
    
end

imwrite(im1,map,fullfile(pathstr, [fname '_3hands_12h_in_30min.gif']),'DelayTime',1/24,'LoopCount',inf) % (12*60*60)/24/60
disp([fname '_3hands_12h_in_30min.gif  has ' num2str(numel(im1)/10^6 ,4) ' Megapixels']) % Category:Animated GIF files exceeding the 50 MP limit
imwrite(im1,map,fullfile(pathstr, [fname '_3hands_12h_in_realtime.gif']),'DelayTime',1,'LoopCount',inf) %
disp([fname '_3hands_12h_in_realtime.gif  has ' num2str(numel(im1)/10^6 ,4) ' Megapixels']) % Category:Animated GIF files exceeding the 50 MP limit

imwrite(im2,map,fullfile(pathstr, [fname '_3hands_1h_in_4min.gif']),'DelayTime',1/15,'LoopCount',inf) % (60*60)/15/60
disp([fname '_3hands_1h_in_4min.gif  has ' num2str(numel(im2)/10^6 ,4) ' Megapixels']) % Category:Animated GIF files exceeding the 50 MP limit
imwrite(im2,map,fullfile(pathstr, [fname '_3hands_1h_in_realtime.gif']),'DelayTime',1,'LoopCount',inf) %
disp([fname '_3hands_1h_in_realtime.gif  has ' num2str(numel(im2)/10^6 ,4) ' Megapixels']) % Category:Animated GIF files exceeding the 50 MP limit

if ispc; dos(['explorer ' pathstr]); end % open folder with files in it

return


function x_y = rotateInMinutes(x_y,minut)
anglee = -minut/60*2*pi;
    rotM = [cos(anglee) -sin(anglee); sin(anglee) cos(anglee)];
    x_y = rotM*x_y;

Αδειοδότηση

Εγώ, ο κάτοχος των πνευματικών δικαιωμάτων αυτού του έργου, το δημοσιεύω δια του παρόντος υπό την εξής άδεια χρήσης:
Creative Commons CC-Zero Το αρχείο αυτό έχει διατεθεί με Creative Commons CC0 1.0 Παγκόσμια Εκχώρηση Κοινού Κτήματος.
Το πρόσωπο που συσχέτισε ένα έργο με αυτή την πράξη έχει απελευθερώσει αυτό το έργο στην δημόσια σφαίρα παραιτούμενος από όλα τα δικαιώματά του σε αυτό το έργο παγκοσμίως υπό τη νομοθεσία των πνευματικών δικαιωμάτων και όλα τα σχετικά ή παρεμφερή νόμιμα δικαιώματα που είχε στο έργο, στο εύρος που νόμος ορίζει. Έργα υπό την CC0 δεν χρειάζονται απόδοση. Όταν παραθέτετε το έργο, δε χρειάζεται να υπαινιχθείτε έγκριση από το συγγραφέα.

Λεζάντες

Δεν ορίστηκε λεζάντα

Items portrayed in this file

απεικονίζει

checksum Αγγλικά

6e327ce05c874a044633a5efdf9e64290768521a

data size Αγγλικά

5.414.675 Byte

252,99999999998192 δευτερόλεπτο

115 εικονοστοιχείο

115 εικονοστοιχείο

Ιστορικό αρχείου

Πατήστε σε μια ημερομηνία/ώρα για να δείτε το αρχείο όπως εμφανιζόταν εκείνη την χρονική στιγμή.

Ημερομηνία/ΏραΜικρογραφίαΔιαστάσειςΧρήστηςΣχόλιο
τρέχον22:27, 27 Απριλίου 2017Μικρογραφία για την έκδοση της 22:27, 27 Απριλίου 2017115 × 115 (5,16 MB)JahobrUser created page with UploadWizard

Η ακόλουθη σελίδα χρησιμοποιεί προς αυτό το αρχείο: