JoshuaDavis icon

HOscillator to strokeWeight

JoshuaDavis | PRO | 01/19/21 11:18:33 PM UTC | 0 ⭐ | 1470 👁️ | Never ⏰ | []
Java |

580 B

|

None

|

0 👍

/

0 👎

import hype.*;
import hype.extended.behavior.HOscillator;
 
HOscillator lineScale;
 
void setup() {
    H.init(this);
    background(#242424);
    size(900, 900, P3D);
 
    lineScale = new HOscillator().range(1.0, 50.0).speed(5).freq(1).waveform(H.SINE); // creates an instance of HOscillator
}
 
void draw() {
    background(#242424);
 
    lineScale.nextRaw(); // fire the next position in the oscillator / this an update function
 
    strokeWeight( lineScale.curr() ); // .curr() gets the current value
    stroke(#FF3300);
    fill(#00616f);
    rect(100, 100, 200, 200);
 
    line(100, 400, 600, 400);
}

Comments