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).

asclass Animation {
  int w = 128, h = 128;
  double fps = 20;
  Graphics2D g;
  
  *() {}
  *(int *w, int *h) {}
  
  void setSize(int w, int h) {
    this.w = w;
    this.h = h;
  }
  
  void setGraphics(Graphics2D g) {
    this.g = g;
  }
  
  // override me
  void start {}
  
  // override me
  void paint {}
  
  // override me
  void nextFrame {}
  
  BufferedImage toImage() {
    var img = whiteImage(w, h);
    setGraphics(createGraphics(img));
    paint();
    ret img;
  }
}

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: 152 / 221
Version history: 3 change(s)
Referenced in: [show references]