Geomerativeライブラリを利用するとフォントのアウトラインデータを参照できるので、
そのデータでちょっとアニメーションを入れてみました。
このライブラリはフォントデータだけでなく、SVGデータにもアクセスできます。
https://vimeo.com/97508025
import geomerative.*;
RFont font;
RShape group;
RPoint[] points;
float[] x;
float[] y;
float[] z;
float[] ax;
float[] ay;
float[] az;
float[] vx;
float[] vy;
float[] vz;
float[] rx;
float[] ry;
float[] rz;
float[] px;
float[] py;
float[] pz;
float offsetx;
float offsety;
float offsetz;
float spring;
float friction;
float deg;
String msg = "a";
void setup () {
size (1000, 800, P3D);
background (255);
frameRate (60);
RG.init (this);
offsetx = 0;
offsety = 0;
offsetz = 0;
group = RG.getText (msg, "Georgia.ttf", 800, CENTER);
points = group.getPoints ();
x = new float[points.length];
y = new float[points.length];
z = new float[points.length];
ax = new float[points.length];
ay = new float[points.length];
az = new float[points.length];
vx = new float[points.length];
vy = new float[points.length];
vz = new float[points.length];
rx = new float[points.length];
ry = new float[points.length];
rz = new float[points.length];
px = new float[points.length];
py = new float[points.length];
pz = new float[points.length];
spring = 0.1;
friction = 0.96;
deg = 0.0;
for (int i = 0; i < points.length; i++) {
ax[i] = 0;
ay[i] = 0;
az[i] = 0;
vx[i] = 0;
vy[i] = 0;
vz[i] = 0;
px[i] = points[i].x + offsetx;
py[i] = points[i].y + offsety;
pz[i] = offsetz;
rx[i] = random (width);
ry[i] = random (height);
rz[i] = random (-1000, 0);
}
}
void draw () {
background (255);
translate (width / 2, (height / 2) + 300, -400);
rotateY (radians (deg));
stroke (100);
strokeWeight (2);
noFill ();
for (int i = 0; i < points.length; i++) {
ax[i] = (px[i] - rx[i]) * spring;
ay[i] = (py[i] - ry[i]) * spring;
az[i] = (pz[i] - rz[i]) * spring;
vx[i] += ax[i];
vy[i] += ay[i];
vz[i] += az[i];
vx[i] *= friction;
vy[i] *= friction;
vz[i] *= friction;
rx[i] += vx[i];
ry[i] += vy[i];
rz[i] += vz[i];
point (rx[i], ry[i], rz[i]);
}
deg += 4.0;
//saveFrame ();
}
void keyPressed () {
msg = str (key);
group = RG.getText (msg, "Georgia.ttf", 800, CENTER);
points = group.getPoints ();
x = new float[points.length];
y = new float[points.length];
z = new float[points.length];
ax = new float[points.length];
ay = new float[points.length];
az = new float[points.length];
vx = new float[points.length];
vy = new float[points.length];
vz = new float[points.length];
rx = new float[points.length];
ry = new float[points.length];
rz = new float[points.length];
px = new float[points.length];
py = new float[points.length];
pz = new float[points.length];
for (int i = 0; i < points.length; i++) {
px[i] = points[i].x + offsetx;
py[i] = points[i].y + offsety;
pz[i] = offsetz;
rx[i] = random (width);
ry[i] = random (height);
rz[i] = random (-1000, 0);
}
}