How to reduce flicking in animation?
Answers were Sorted based on User's Feedback
Double Buffering
sample code of java to reduce flinking :
public void update(Graphics g) {
Graphics offgc;
Image offscreen = null;
Dimension d = size();
offscreen = createImage(d.width, d.height);
offgc = offscreen.getGraphics();
offgc.setColor(getBackground());
offgc.fillRect(0, 0, d.width, d.height);
offgc.setColor(getForeground());
paint(offgc);
g.drawImage(offscreen, 0, 0, this);
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / m. abhishek
By using offGra first draw whole animated image on a blank
Image and put this image directly on the screen
so at the time of animation the each movement of image can
draw
in other image and put this Image to screen.
| Is This Answer Correct ? | 0 Yes | 2 No |
What is considered an anti pattern?
What is the null?
What is the output of the below java program?
what is the use of thread?Justify it by project point of view
what is mean by ooad? where we are using? can you tell me any real time example?
What are measurable parameters?
Tell me the latest versions in java related areas?
How do weakhashmap works?
Can we have this () and super () together?
What is public static?
Which command from the jdk compiles a java program?
Differentiate between a class and an object.