|
|
|
@ -9,6 +9,7 @@ import java.awt.Graphics2D;
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 动画支持类,用于存储动画状态并实现动画。 |
|
|
|
|
* 逻辑保持与AnimatedIcon逻辑一致。 |
|
|
|
|
* |
|
|
|
|
* @author vito |
|
|
|
|
* @since 12.0 |
|
|
|
@ -29,6 +30,10 @@ class AnimatedPainterSupport {
|
|
|
|
|
private int width; |
|
|
|
|
private int height; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 用于包内绘制,保持与AnimatedIcon逻辑一致。 |
|
|
|
|
* 后期整合逻辑之后在整理代码质量 |
|
|
|
|
*/ |
|
|
|
|
static void paint(AnimatedPainter painter, Component c, Graphics g, |
|
|
|
|
int x, int y, int width, int height) { |
|
|
|
|
if (!isAnimationEnabled(painter, c)) { |
|
|
|
@ -115,8 +120,9 @@ class AnimatedPainterSupport {
|
|
|
|
|
// animated value to the new target value with reduced duration
|
|
|
|
|
as.animator.cancel(); |
|
|
|
|
int duration2 = (int) (animationDuration * as.fraction); |
|
|
|
|
if (duration2 > 0) |
|
|
|
|
if (duration2 > 0) { |
|
|
|
|
as.animator.setDuration(duration2); |
|
|
|
|
} |
|
|
|
|
as.startValue = as.animatedValue; |
|
|
|
|
} else { |
|
|
|
|
// new animation
|
|
|
|
@ -153,8 +159,9 @@ class AnimatedPainterSupport {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void saveRepaintLocation(AnimatedPainter painter, Component c, int x, int y) { |
|
|
|
|
if (!isAnimationEnabled(painter, c)) |
|
|
|
|
if (!isAnimationEnabled(painter, c)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
AnimatedPainterSupport[] ass = (AnimatedPainterSupport[]) ((JComponent) c).getClientProperty(painter.getClientPropertyKey()); |
|
|
|
|
if (ass != null) { |
|
|
|
|