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

30
LINES

< > BotCompany Repo | #1013742 // Heart Beat [tested on Windows & Linux]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 994K of libraries. Click here for Pure Java version (1790L/11K).

!7

p { pMain(HeartBeat); }

public sclass HeartBeat extends PApplet {
  public void settings() { size(600, 200); }
  
  int x = 0;
  float py = 0;
 
  public void setup() {
    background(0);
  }
 
  public void draw() {
    noStroke();
    fill(0,0,0,15);
    rect(0,0,width,height);
    translate(0,height/2);
    x++;
    x%=width;
    float fx = py + random(-20,20);
    stroke(100,255,100);
    noFill();
    line(x-1,py, x,fx);
    py = fx;
    if(py>height/2) py=height/2;
    if(py<-height/2) py=-height/2;
  }
}

Author comment

Began life as a copy of #1013741

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jmyaexzvplwz, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013742
Snippet name: Heart Beat [tested on Windows & Linux]
Eternal ID of this version: #1013742/5
Text MD5: b9a2ffa68784df7674244ce3c1e92b3e
Transpilation MD5: 0ccd44463e43636c73af84305f83f8fd
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-02-12 17:02:37
Source code size: 550 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 535 / 1313
Version history: 4 change(s)
Referenced in: #1013744 - Heart Beat, 2x Bigger [OK on Windows & Linux]
#1014265 - Heart Beat without extra class (doesn't work, PApplet methods clash with JavaX functions)