File:AnalogClockAnimation1_3hands_1h_in_4min.gif
From Wikipedia, the free encyclopedia
AnalogClockAnimation1_3hands_1h_in_4min.gif (115×115 điểm ảnh, kích thước tập tin: 4,93 MB, kiểu MIME: image/gif, có lặp, 3.601 khung ảnh, 4 min 13 s)
Tập tin này từ Wikimedia Commons. Trang miêu tả nó ở đấy được sao chép dưới đây. Commons là kho lưu trữ tập tin phương tiện có giấy phép tự do. Bạn có thể tham gia. |
Miêu tả
Miêu tảAnalogClockAnimation1 3hands 1h in 4min.gif |
Deutsch: Animation einer Analoguhr
English: Animation of an analog clock |
Ngày | |
Nguồn gốc | Tác phẩm được tạo bởi người tải lên |
Tác giả | Jahobr |
Phiên bản khác |
|
GIF genesis InfoField | |
Mã nguồn InfoField | MATLAB codefunction AnalogClockAnimation1()
% source code that produces a GIF and a SVG
%
% 2017-04-28 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 1000 1000]); % 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',5,'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.95 1]; % y
x_y = rotateInMinutes(x_y,minut);
plot(x_y(1,:),x_y(2,:),'LineWidth',3,'color',[0 0 0]) % line
end
for minut = 5:5:60 % hour marks
x_y = [0 0;... x
0.9 1]; % y
x_y = rotateInMinutes(x_y,minut);
plot(x_y(1,:),x_y(2,:),'LineWidth',5,'color',[0 0 0]) % line
end
for hou = 1:12 % hour numbers
x_y = [0;... x
0.79]; % y
x_y = rotateInMinutes(x_y,hou*5);
if or( hou==10 , hou==11 )
x_y(1,:) = x_y(1,:)+0.03;
end
text(x_y(1,:),x_y(2,:),num2str(hou),'color',[0 0 0],'VerticalAlignment','middle','HorizontalAlignment','center','FontUnits','normalized','FontSize',0.09,'FontName','Helvetica') % 'Interpreter','latex') % line
end
% hour hand
angleOffPoints = linspace(0,2*pi,49);
radii = ones(size(angleOffPoints))*0.06;
radii(13) = 0.65;
radii([12 14]) = 0.40;
radii([11 15]) = 0.1;
[X_hour,Y_hour] = pol2cart(angleOffPoints,radii);
h_hour = patch(X_hour,Y_hour,map(3,:),'EdgeColor',[0 0 0],'LineWidth',2.5); %
% minute hand
angleOffPoints = linspace(0,2*pi,49);
radii = ones(size(angleOffPoints))*0.045;
radii(13) = 0.95;
radii([12 14]) = 0.8;
angleOffPoints(12) = angleOffPoints(12)+0.1;
angleOffPoints(14) = angleOffPoints(14)-0.1;
[X_minu,Y_minu] = pol2cart(angleOffPoints,radii);
h_minu = patch(X_minu,Y_minu,map(2,:),'EdgeColor',[0 0 0],'LineWidth',2.5); %
% second hand
angleOffPoints = linspace(0,2*pi,49);
radii = ones(size(angleOffPoints))*0.03;
radii(13) = 0.94;
radii([12 14]) = 0.91;
[X_sec,Y_sec] = pol2cart(angleOffPoints,radii);
X_sec(12) = X_sec(11); % create vertical line
X_sec(14) = X_sec(15); % create vertical line
h_sec = patch(X_sec,Y_sec,map(1,:),'EdgeColor',[0 0 0],'LineWidth',2.5); %
%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3-hands %%%%%%%%%%%%%%%%%%%%%%%%%%%%
nFrames = 60*60+1;
for iFrame = 1:nFrames
secon = iFrame-1;
x_y = rotateInMinutes([X_hour;Y_hour],secon/60/60*5);
set(h_hour,'xData',x_y(1,:),'yData',x_y(2,:));
x_y = rotateInMinutes([X_minu;Y_minu],floor(secon/60));
set(h_minu,'xData',x_y(1,:),'yData',x_y(2,:));
x_y = rotateInMinutes([X_sec;Y_sec],secon);
set(h_sec,'xData',x_y(1,:),'yData',x_y(2,:));
drawnow;
%% save animation 1 "3 hands"
f = getframe(figHandle);
f1 = imresize(f.cdata,115/1000); % 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
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
end
imwrite(im1,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(im1)/10^6 ,4) ' Megapixels']) % Category:Animated GIF files exceeding the 50 MP limit
imwrite(im1,map,fullfile(pathstr, [fname '_3hands_1h_in_realtime.gif']),'DelayTime',1,'LoopCount',inf) %
disp([fname '_3hands_1h_in_realtime.gif has ' num2str(numel(im1)/10^6 ,4) ' Megapixels']) % Category:Animated GIF files exceeding the 50 MP limit
%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2-hands %%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(figHandle, 'position',[1 1 900 900]); % big start image for antialiasing later [x y width hight]
set(h_sec,'xData',X_sec,'yData',Y_sec+10); % move second hand out
nFrames = 60*12;
for iFrame = 1:nFrames
minu = iFrame-1;
x_y = rotateInMinutes([X_hour;Y_hour],minu/60*5);
set(h_hour,'xData',x_y(1,:),'yData',x_y(2,:));
x_y = rotateInMinutes([X_minu;Y_minu],floor(minu));
set(h_minu,'xData',x_y(1,:),'yData',x_y(2,:));
%% 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
if iFrame == 27*60+13
if ~isempty(which('plot2svg'))
plot2svg(fullfile(pathstr, [fname '.svg']),figHandle) % by Juerg Schwizer
else
disp('plot2svg.m not available; see http://www.zhinst.com/blogs/schwizer/');
end
end
%% 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
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;
|
Giấy phép
Tôi, người giữ bản quyền tác phẩm này, từ đây phát hành nó theo giấy phép sau:
Tập tin này được phân phối theo Creative Commons Hiến tặng vào Phạm vi Công cộng Toàn thế giới CC0. | |
Người nào gán tài liệu này với tác phẩm nghĩa là đã hiến tác phẩm cho phạm vi công cộng bằng cách từ bỏ mọi quyền lợi của người đó đối với tác phẩm theo quy định của luật bản quyền, có hiệu lực trên toàn thế giới và các quyền lợi pháp lý phụ mà người đó có được trong tác phẩm, đến mức độ mà luật pháp cho phép. Bạn được tự do sao chép, phân phối, và biểu diễn tác phẩm này, tất cả đều không bắt buộc ghi công.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
Khoản mục được tả trong tập tin này
mô tả
Giá trị nào đó không có khoản mục Wikidata
28 4 2017
image/gif
checksum Tiếng Anh
5b2c2f6dcfd0f31b801c6bec9a3d30e48c4f2a6f
5.165.577 byte
252,99999999998192 giây
115 pixel
115 pixel
Lịch sử tập tin
Nhấn vào ngày/giờ để xem nội dung tập tin tại thời điểm đó.
Ngày/giờ | Hình xem trước | Kích cỡ | Thành viên | Miêu tả | |
---|---|---|---|---|---|
hiện tại | 22:27, ngày 27 tháng 4 năm 2017 | 115×115 (4,93 MB) | Jahobr | User created page with UploadWizard |
Trang sử dụng tập tin
Chưa có trang nào ở Wikipedia tiếng Việt liên kết đến tập tin này.
Sử dụng tập tin toàn cục
Những wiki sau đang sử dụng tập tin này:
- Trang sử dụng tại en.wiktionary.org