Sha256: 22cafaaf0d4ecec92a956b8e61ca5abdbbe46659b043e1b4b52d40044c78e8d3
Contents?: true
Size: 714 Bytes
Versions: 9
Compression:
Stored size: 714 Bytes
Contents
package wordcram; import processing.core.*; public class SwirlWordPlacer implements WordPlacer { @Override public PVector place(Word word, int wordIndex, int wordsCount, int wordImageWidth, int wordImageHeight, int fieldWidth, int fieldHeight) { float normalizedIndex = (float) wordIndex / wordsCount; float theta = normalizedIndex * 6 * PConstants.TWO_PI; float radius = normalizedIndex * fieldWidth / 2f; float centerX = fieldWidth * 0.5f; float centerY = fieldHeight * 0.5f; float x = PApplet.cos(theta) * radius; float y = PApplet.sin(theta) * radius; return new PVector(centerX + x, centerY + y); } }
Version data entries
9 entries across 9 versions & 1 rubygems