投稿者 スレッド: 秒針のようなものを円の外周を時計の外枠と見立てて秒針をアニメーションさせたいです  (Read 941 times)

tyanpira

  • 新ユーザー
  • *
  • 投稿: 3
表題の物を昨日夢うつつで考え付きました。
今30分ほどパソコンの前でヘルプを読みながらプログラム作成しています。
ただここで、秒針以外はずっと表示、秒針に見立てた線分だけを、動いているように見せたいのです。
別に、時計すべてを消して秒針のベクトルの向きを一回ごとに、{(2*pi)/60}ラジアンずらして表示したいです。
夢ではmathgraph Onがないと思っていてwindow の原点から時計の中心を、原点になるように平行移動させてやるために、左上隅の原点を円の中心まで持ってきてあげて。
Y軸の方向を上から下ではなく下から上向きにするのにマイナスをつけてあげる。
 わかりやすくするために、座標軸を書き入れました、
 このときは、mathgraph On です。
以下に途中までのプログラムのコピーを上げておきます。
gscreen(400,400)
window (-30,-30)-(30,30)
MathGraph On
line (-30,0)-(30,0),5
line (0,-30)-(0,30),8
circle (0,0),5,1
circle (0,0),30,1
ちなみに、真ん中の、半径5の円は、時計の中心があったほうが絵的に時計に見えるというかきれいだと思って足しました。
修正改良版です。
3600秒(1時間)連続実行するプログラム仕様です。
プログラムを中断するには、
メニューバー、の、実行 を、クリック
メニューから、プログラムの中断 をクリック
グラフィック画面を、右上の閉じるボタン(バツ印)をクリックで閉じて
メニューバーの、プログラム をクリック
終了 を、クリックして
終了しますか?
はい をクリックすると、終了することができるよ。

gscreen(800,800):D$=time$
'second =Val(right$(D$,2))
'print "現在は";second;"秒です"
window (-35,-35)-(35,35)
MathGraph On
Degrees
glocate (-1,30):gfontsize = 60:gprint "12"
glocate (28,1):gfontsize = 85:gprint "3"
glocate (-1,-28):gfontsize = 85:gprint "6"
glocate (-28,1):gfontsize = 85:gprint "9"
'line (-30,0)-(30,0),5
'line (0,-30)-(0,30),8
circle (0,0),5,0
circle (0,0),30,0
'line (0,0)-(0,30)
dim c as real
let c = 0'黒色で描画
dim e as real
let e = 12'赤色で描画
dim a as real
let a = -1
Do Until a =>3600
a=a+1
cls 2
'line (-30,0)-(30,0),5
'line (0,-30)-(0,30),8
circle (0,0),5,0
circle (0,0),30,0
glocate (-4,25):gfontsize = 70:gprint "12"
glocate (19,5.5):gfontsize = 85:gprint "3"
glocate (-2.5,-15.5):gfontsize = 85:gprint "6"
glocate (-23,5.5):gfontsize = 85:gprint "9"
for d=0 to 360 step 6
 if (d = 0) or (d=90) or (d=180) or (d=270) or (d=360) then line (30*sin(d),30*cos(d))-(25*sin(d),25*cos(d)),12  else line (30*sin(d),30*cos(d))-(25*sin(d),25*cos(d)),0
next d
line (0,0)-(30*sin(6*a),30*cos(6*a)),0'秒針
line (0,0)-(26*sin(a/10),26*cos(a/10)),0'分針
line (0,0)-(24*sin(a/600),24*cos(a/600)),0'時針
'D$=time$:second =Val(right$(D$,2)):print "現在は";second;"秒です"
Sleep(1000)
loop
« Last Edit: 2024年 8月 18日 , 午後 06:35:40 by tyanpira »