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

1  
!7
2  
3  
p { pMain(HeartBeat); }
4  
5  
public sclass HeartBeat extends PApplet {
6  
  public void settings() { size(600, 200); }
7  
  
8  
  int x = 0;
9  
  float py = 0;
10  
 
11  
  public void setup() {
12  
    background(0);
13  
  }
14  
 
15  
  public void draw() {
16  
    noStroke();
17  
    fill(0,0,0,15);
18  
    rect(0,0,width,height);
19  
    translate(0,height/2);
20  
    x++;
21  
    x%=width;
22  
    float fx = py + random(-20,20);
23  
    stroke(100,255,100);
24  
    noFill();
25  
    line(x-1,py, x,fx);
26  
    py = fx;
27  
    if(py>height/2) py=height/2;
28  
    if(py<-height/2) py=-height/2;
29  
  }
30  
}

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: 415 / 1006
Version history: 4 change(s)
Referenced in: [show references]