• 追加された行はこの色です。
  • 削除された行はこの色です。
TITLE:Wipeアニメーションで画像を表示
#navi(../)
RIGHT:Posted by [[aterai]] at 2004-10-18
*Wipeアニメーションで画像を表示 [#z57d00bc]
Posted by [[terai]] at 2004-10-18

#contents

**概要 [#ta59a8ef]
WipeアニメーションでPNG画像を表示します。

-&jnlp;
-&jar;
-&zip;

#screenshot
//#screenshot
#ref(http://lh3.ggpht.com/_9Z4BYR88imo/TQTWzXTVO0I/AAAAAAAAAp0/SoNEMaoYEoQ/s800/Wipe.png)

**サンプルコード [#w7fb70a8]
#code{{
class WipeImage extends JComponent implements ActionListener {
  private int ww = 0;
  public WipeImage() {
    super();
    setBackground(Color.BLACK);
  }
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    int iw = (int)icon.getIconWidth();
    int ih = (int)icon.getIconHeight();
    if(direction) {
      if(ww<iw) ww=ww+10;
      else animator.stop();
    }else{
      if(ww>0) ww=ww-10;
      else animator.stop();
    }
    g.drawImage(icon.getImage(), 0, 0, iw, ih, this);
    g.fillRect(ww, 0, iw-ww, ih);
  }
  public void actionPerformed(ActionEvent e) {
    repaint();
  }
}
}}

**解説 [#de5d804d]
画像の上に、徐々に位置と幅を変更しながら矩形を描画することでWipeしています。

//**参考リンク
**コメント [#xe6a52cb]
- テスト --  &new{2008-05-10 (土) 17:30:42};

#comment