Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

33
LINES

< > BotCompany Repo | #1033724 // Animation

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4653L/26K).

1  
asclass Animation {
2  
  int w = 128, h = 128;
3  
  double fps = 20;
4  
  Graphics2D g;
5  
  
6  
  *() {}
7  
  *(int *w, int *h) {}
8  
  
9  
  void setSize(int w, int h) {
10  
    this.w = w;
11  
    this.h = h;
12  
  }
13  
  
14  
  void setGraphics(Graphics2D g) {
15  
    this.g = g;
16  
  }
17  
  
18  
  // override me
19  
  void start {}
20  
  
21  
  // override me
22  
  void paint {}
23  
  
24  
  // override me
25  
  void nextFrame {}
26  
  
27  
  BufferedImage toImage() {
28  
    var img = whiteImage(w, h);
29  
    setGraphics(createGraphics(img));
30  
    paint();
31  
    ret img;
32  
  }
33  
}

Author comment

Began life as a copy of #1033723

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033724
Snippet name: Animation
Eternal ID of this version: #1033724/4
Text MD5: 36008a7fb5dc655afca01f80ab51fd65
Transpilation MD5: 1c0cd9401854d8d455b7a9312f496924
Author: stefan
Category: javax / gazelle v
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-30 22:14:35
Source code size: 518 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 154 / 224
Version history: 3 change(s)
Referenced in: [show references]