Swing/Wipe のバックアップの現在との差分(No.18)
- バックアップ一覧
- 差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/Wipe へ行く。
- 1 (2004-10-18 (月) 02:23:59)
- 2 (2004-10-18 (月) 02:27:56)
- 3 (2004-11-04 (木) 10:13:50)
- 4 (2005-04-28 (木) 04:33:11)
- 5 (2005-09-03 (土) 15:15:40)
- 6 (2006-02-05 (日) 02:29:45)
- 7 (2006-02-27 (月) 16:33:16)
- 8 (2006-04-12 (水) 20:28:12)
- 9 (2007-03-17 (土) 16:24:42)
- 10 (2007-04-13 (金) 03:38:52)
- 11 (2008-05-10 (土) 17:30:42)
- 12 (2011-05-18 (水) 16:01:08)
- 13 (2013-04-13 (土) 04:35:31)
- 14 (2015-01-07 (水) 16:16:47)
- 15 (2016-01-29 (金) 14:01:47)
- 16 (2017-06-30 (金) 13:54:28)
- 17 (2018-06-01 (金) 15:05:01)
- 18 (2020-06-02 (火) 19:03:36)
- 19 (2021-11-18 (木) 11:29:22)
- 追加された行はこの色です。
- 削除された行はこの色です。
--- category: swing folder: Wipe title: Wipeアニメーションで画像を表示 tags: [Animation, Image, Timer] author: aterai pubdate: 2004-10-18T02:23:59+09:00 description: WipeアニメーションでPNG画像を表示します。 image: https://lh3.googleusercontent.com/_9Z4BYR88imo/TQTWzXTVO0I/AAAAAAAAAp0/SoNEMaoYEoQ/s800/Wipe.png --- * 概要 [#summary] `Wipe`アニメーションで`PNG`画像を表示します。 #download(https://lh3.googleusercontent.com/_9Z4BYR88imo/TQTWzXTVO0I/AAAAAAAAAp0/SoNEMaoYEoQ/s800/Wipe.png) * サンプルコード [#sourcecode] #code(link){{ class WipeImage extends JComponent implements ActionListener { private int ww = 0; public WipeImage() { super(); setBackground(Color.BLACK); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); int iw = (int) icon.getIconWidth(); int ih = (int) icon.getIconHeight(); if (direction) { if (ww < iw) { ww += 10; } else { animator.stop(); } } else { if (ww > 0) { ww -= 10; } else { animator.stop(); } } g.drawImage(icon.getImage(), 0, 0, iw, ih, this); g.fillRect(ww, 0, iw - ww, ih); } @Override public void actionPerformed(ActionEvent e) { repaint(); } } }} * 解説 [#explanation] 上記のサンプルでは、`Timer`を使用して位置と幅を変更しながら画像の上に矩形を描画することで`Wipe`しています。 上記のサンプルでは、`Timer`を使用して位置と幅を変更しながら画像の上に矩形を描画することで`Wipe`アニメーションを実行しています。 * 参考リンク [#reference] - [[Fadeアニメーションで画像を表示>Swing/Fade]] * コメント [#comment] #comment #comment