CLOCK.PAS 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Uses Graph,CRT;
  2. Var
  3. d,r,r1,r2,rr,k,
  4. x1,y1,x2,y2,x01,y01: Integer;
  5. Xasp, Yasp: Word;
  6. begin
  7. d := detect;
  8. InitGraph(d,r,'');
  9. x1 := GetMaxX div 2;
  10. y1 := GetMaxY div 2;
  11. GetAspectRatio(Xasp,Yasp);
  12. r:= round(3*GetMaxY*Yasp/8/Xasp);
  13. r1:= round(0.9*r);
  14. r2:= round(0.95*r);
  15. Circle(x1,y1,r);
  16. Circle(x1,y1,round(1.02*r));
  17. for k := 0 to 59 do
  18. begin
  19. if k mod 5 = 0 then
  20. rr:=r1
  21. else
  22. rr:=r2;
  23. x01:= x1 + round(rr*sin(2*pi*k/60));
  24. y01:= y1 - round(rr*Xasp*cos(2*pi*k/60)/Yasp);
  25. x2:= x1 + round(r*sin(2*pi*k/60));
  26. y2:= y1 - round(r*Xasp*cos(2*pi*k/60)/Yasp);
  27. Line(x01,y01,x2,y2);
  28. end;
  29. SetWriteMode(XorPut);
  30. SetLineStyle(SolidLn,0,ThickWidth);
  31. r:=0;
  32. repeat
  33. for k := 0 to 59 do
  34. if not keypressed then begin
  35. x2:= x1 + round(0.85*r1*sin(2*pi*r/60/12));
  36. y2:= y1 - round(0.85*r1*Xasp*cos(2*pi*r/60/12)/Yasp);
  37. x01:= x1 + round(r2*sin(2*pi*k/60));
  38. y01:= y1 - round(r2*Xasp*cos(2*pi*k/60)/Yasp);
  39. Line(X1,y1,x2,y2);
  40. Line(x1,y1,x01,y01);
  41. Delay(100);
  42. Line(x1,y1,x01,y01);
  43. Line(X1,y1,x2,y2);
  44. inc(r);
  45. if r=12*60 then r:=0;
  46. end
  47. Until keypressed;
  48. if readkey=#0 then k := ord(readkey);
  49. CloseGraph;
  50. End.