Sha256: 76bec902ff24719fefd4131456ad90bb432cb1ff8d1284a7bd89f61a74081d2d

Contents?: true

Size: 1.11 KB

Versions: 9

Compression:

Stored size: 1.11 KB

Contents

package wordcram;

import processing.core.PApplet;
import processing.core.PVector;

/**
 * If you're using a custom WordNudger, and having difficulty seeing
 * how well it works, try wrapping it in a PlottingWordNudger. As your
 * WordCram is drawn, it'll render tiny dots at each location it
 * nudges your words to, so you can see how well it's working.
 */
public class PlottingWordNudger implements WordNudger {

    private final PApplet parent;
    private final WordNudger wrappedNudger;

    public PlottingWordNudger(PApplet _parent, WordNudger _wrappedNudger) {
        parent = _parent;
        wrappedNudger = _wrappedNudger;
    }

    @Override
    public PVector nudgeFor(Word word, int attempt) {
        PVector v = wrappedNudger.nudgeFor(word, attempt);
        parent.pushStyle();
        parent.noStroke();

        float alpha = attempt/700f;
        //alpha = (float) Math.pow(alpha, 3);
        parent.fill(40, 255, 255); //, alpha * 255);

        PVector wordLoc = PVector.add(v, word.getTargetPlace());
        parent.ellipse(wordLoc.x, wordLoc.y, 3, 3);
        parent.popStyle();
        return v;
    }

}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ruby_wordcram-2.1.1 src/wordcram/PlottingWordNudger.java
ruby_wordcram-2.1.0 src/wordcram/PlottingWordNudger.java
ruby_wordcram-2.0.6 src/wordcram/PlottingWordNudger.java
ruby_wordcram-2.0.5 src/wordcram/PlottingWordNudger.java
ruby_wordcram-2.0.4 src/wordcram/PlottingWordNudger.java
ruby_wordcram-2.0.3 src/wordcram/PlottingWordNudger.java
ruby_wordcram-2.0.2 src/wordcram/PlottingWordNudger.java
ruby_wordcram-2.0.1 src/wordcram/PlottingWordNudger.java
ruby_wordcram-2.0.0 src/wordcram/PlottingWordNudger.java