Skip to content

Commit

Permalink
new basic example code
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsijben committed Mar 14, 2024
1 parent 435350e commit 4f81f2a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
29 changes: 7 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,18 @@ Install the library by downloading the latest release through the Processing con
## Usage

```
// Import the library to your sketch
import bpm.library.beatsperminute.*;
// Create the bpm object
BeatsPerMinute bpm;
void setup(){
size(500,500);
// Initialize the bpm object
bpm = new BeatsPerMinute(this)
//.setBPM(120) // set the starting bpm to 120
.showInfoPanel() // show the infopanel at the start
//.setInfoPanelY(200) // set the y location of the infopanel to 200
//.setInfoPanelKey('o') // set the hotkey for toggling the infopanel to 'o'
//.disableKeyPress() // disable listening to keypresses
;
void setup() {
size(500, 500);
bpm = new BeatsPerMinute(this);
bpm.setBPM(30);
}
void draw(){
background(100);
// Use a timing function from the bpm object
float radius = 20 + bpm.linear() * 50;
// or: float radius = map(bpm.linear(), 0, 1, 20, 70);
// or: float radius = lerp(20, 70, bpm.linear());
circle(width/2, height/2, radius);
void draw() {
background(50);
circle(width/2, height/2, bpm.easeBounce()*500);
}
```

Expand Down
1 change: 1 addition & 0 deletions examples/BPM_Timings/basic/BeatsPerMinute.java
1 change: 1 addition & 0 deletions examples/BPM_Timings/basic/InfoPanel.java
20 changes: 20 additions & 0 deletions examples/BPM_Timings/basic/basic.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* basic
* https://github.com/vincentsijben/bpm-timings-for-processing
*
* Animate a circle on each beat.
*/

import bpm.library.beatsperminute.*;
BeatsPerMinute bpm;

void setup() {
size(500, 500);
bpm = new BeatsPerMinute(this);
bpm.setBPM(30);
}

void draw() {
background(50);
circle(width/2, height/2, bpm.easeBounce()*500);
}
4 changes: 2 additions & 2 deletions resources/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ source.repository=https://github.com/vincentsijben/bpm-tmings-for-processing.git
# This is used to compare different versions of the same Library, and check if
# an update is available.

library.version=9
library.version=10


# The version as the user will see it.

library.prettyVersion=1.1.4
library.prettyVersion=1.1.5


# The min and max revision of Processing compatible with your Library.
Expand Down

0 comments on commit 4f81f2a

Please sign in to comment.