XPCE で簡単なアニメーション (正確には4 つのメガネのパズル) を作成します。私は XPCE についてまったく何も知らないので、チュートリアルを調べましたが、結果は期待外れでした。次の資料を教えてください。
- 「キャンバス」で作業する
- アニメーション
- タイマー
編集: わかりました、ここでより詳細な問題があります: 2 つのボックスを描画し、2 秒待って、ボックスを非表示にしてから、タイマーを開始します。
new(@box1, box(100,100)),
send(W, display, @box1),
new(@box2, box(100,100)),
send(W, display, @box2, point(200, 200)),
% wait two seconds here
% hide the boxes here
new(Msg1, and(message(B1, relative_move, point(5, 0)),
message(B4, relative_move, point(0, 5)))),
send(W, attribute, attribute(timer, new(T, timer(0.1, Msg1)))),
send(T, start),
編集2:さて、ここに別の質問があります(新しい質問を開く必要がありますか?):これは私が使用しているコードです:
get_file(0, 'glass.gif').
get_file(180, 'glass180.gif').
main(GA, GB, GC, GD) :- % e.g. main(0,0,180,0).
new(B1, figure),
get_file(GA, G1),
send(B1, display, new(BM1, bitmap(G1))),
send(BM1, transparent, @on),
send(W, display, B1, point(0,0)),
%analogically for the other three glasses
に新しいビットマップを設定したいのですがB1
。それ、どうやったら出来るの?変更BM1
するだけで十分でしょうか?または、おそらく代替ソリューションがありますか?直立メガネと逆メガネの両方を画面外に描画して交換することを考えていましたが、そのような解決策の詳細についてはわかりません。
EDIT2':解決しました。後世のために:
send(B1, clear),
send(B1, display, bitmap('glass_while_animating_1.gif')),
send(timer(0.1), delay),
send(B1, clear),
send(B1, display, bitmap('glass_while_animating_2.gif')),
% etc