Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
動作するコードはまったくありませんが、ボブルする必要がある画像を表示する方法を投稿します。
public void onDraw(Canvas can){ can.drawBitmap(bobbleHead , xpos, ypos, p); }
と を宣言xposしyposました。
xpos
ypos
頭を上下に動かすだけの場合は、sin関数を使用してyposを変更する必要があります。たとえば、頭を1秒に1回上下に動かしたい場合は、秒単位の時間を使用してyposを計算できます。
sin
time = now - start; ypos = ypos_at_rest + ypos_extension * sin(time * pi * 2.0);
構文が少しずれている場合はご容赦ください。JavaをCから外挿しています。