summaryrefslogtreecommitdiff
path: root/lasertext/src/ofApp.h
diff options
context:
space:
mode:
Diffstat (limited to 'lasertext/src/ofApp.h')
-rw-r--r--lasertext/src/ofApp.h38
1 files changed, 35 insertions, 3 deletions
diff --git a/lasertext/src/ofApp.h b/lasertext/src/ofApp.h
index a15d918..3fcde84 100644
--- a/lasertext/src/ofApp.h
+++ b/lasertext/src/ofApp.h
@@ -2,6 +2,8 @@
#include "ofMain.h"
#include "ofxSvg.h"
+#include "ofxGui.h"
+#include "ofxXmlSettings.h"
#include "ofxHelios.h"
#include "colourPolyline.h"
@@ -83,6 +85,13 @@ public:
}
return _w+max((float)(words.size()-1)*enspace,0.0f);
}
+ int glyphCount(){
+ int c=0;
+ for (auto& w:words){
+ c+=w.glyphs.size();
+ }
+ return c;
+ }
string text(){
string s;
for (auto& w:words) {
@@ -170,13 +179,25 @@ public:
void clear(){words.clear();}
void update(float period=1.0f){
float t=ofGetElapsedTimef()/period;
- int theword=int(t)%words.size();
- float segment=t-int(t);
+ int theword=0;
+ float segment=0.0f;
+ if (false){ //1 word per second
+ theword=int(t)%words.size();
+ segment=t-int(t);
+ }
+ else { //proportional to #of letters
+ int theletter=int(t)%glyphCount();
+ theword=0;
+ while((theletter-=words[theword].glyphs.size())>0){
+ theword++;
+ }
+ segment=(((float)theletter+words[theword].glyphs.size()+t-int(t))/words[theword].glyphs.size());
+ }
//calculate params for word/letter anim
for (int i=0;i<words.size();i++){
words[i].amount=(i==theword?sin(segment*3.1415):0);
for (auto& g:words[i].glyphs){
- if (ofRandom(period)<0.1) {
+ if (ofRandom(period)<0.01) {
g.randomiseColour();
}
}
@@ -231,4 +252,15 @@ class ofApp : public ofBaseApp{
string displaytext;
glyphbanner banner;
+ //======= laser gui
+
+ ofxPanel lasergui;
+ ofParameter<bool> laser_power;
+ ofParameter<int> laser_intensity;
+ ofParameter<int> laser_points;
+ ofParameter<int> laser_subdivide;
+ ofParameter<int> laser_blank_num;
+ ofParameter<float> laser_max_angle;
+
+ ofxXmlSettings XML;
};