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

28
LINES

< > BotCompany Repo | #1014265 // Heart Beat without extra class (doesn't work, PApplet methods clash with JavaX functions)

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

Download Jar. Transpiled version (1796L) is out of date.

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

Author comment

Began life as a copy of #1013742

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1014265
Snippet name: Heart Beat without extra class (doesn't work, PApplet methods clash with JavaX functions)
Eternal ID of this version: #1014265/4
Text MD5: 4e224ebdf776d4c1503a898a5bd6368d
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-19 15:21:40
Source code size: 467 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 456 / 1137
Version history: 3 change(s)
Referenced in: [show references]