First launch animation Swing



  • It is necessary that, when the first launch of the programme, it delineate the schedule of the intended function with animation and then simply withdraw it static. There are no problems with the second paragraph and the first to be separate. I'll make it work together. Detection of a static timeline with a parking lot below the window size. How do you do animation?

    @Override
    protected void paintComponent(Graphics g) {
    
    for (double k = 0; k <= Main.L; k += 0.125) {
        g.drawOval((int) Math.round(k * usefullCoef) + STARTPOINTX, (int) Math.round((Main.frame.getContentPane().getHeight()) - Main.wayConstruct(k, Main.answer1) * usefullCoef - STARTPOINTY), 2, 2);
        g.drawOval((int) Math.round(k * usefullCoef) + STARTPOINTX, (int) Math.round((Main.frame.getContentPane().getHeight()) - Main.wayConstruct(k, Main.answer2) * usefullCoef - STARTPOINTY), 2, 2);
    }
    



  • You have a component that draws points, it's a static picture. You want animation.

    • Determine what animation is (e.g., you want to gradually show a function for the larger maximums x).
    • Do a human number field in your component and redesign. paintComponent to draw an arbitrary frame. Either you can remember the moment when the animation began, and you can calculate the footage, depending on the past, inspired by the uneven work of the timer.
    • Then change the number of the shot and call it. repaint()



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2