We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi I'm trying to make video files load to represent letters (motion font basically); For some reason the video files don't show. I tried following the examples but no succes. I'm also not getting any error.
Any ideas?
String str = "abbaabbaa abb aabbaaab baaab";
int let = 0;
int wordsNum = 1;
int t = 0;
int[] wordsLength;
float kerning = 0;
float leading = 0;
float charLocation = 0;
float lineLocation = 0;
float horMargin = 100;
float vertMargin = 100;
float fontHeight = 30;
float fontWidth = 40;
import processing.video.*;
Movie Alef;
Movie Bet;
Movie Gimel;
Movie Dalet;
Movie Hey;
Movie Vav;
public void setup() {
size(1200, 900);
// finding out how many words are there (important for the wordsLength array)
for (int i = 0; i<str.length(); i++) {
if (str.charAt(i)==' ') {
wordsNum++;
}
}
println("number of words is: ", wordsNum);
int letCount = 0;
wordsLength = new int[wordsNum];
for (int i = 0; i<str.length(); i++) {
if (str.charAt(i)==' ') {
wordsLength[t]=letCount;
letCount=0;
t++;
} else {
letCount++;
}
}
println(wordsLength);
//alef = loadImage("א.jpg");
//bet = loadImage("ב.jpg");
Alef = new Movie(this, "a.wmv");
Alef.loop();
Bet = new Movie(this, "b.wmv");
Bet.loop();
t=0;
}
void draw() {
for (int let = 0; let < str.length(); let++) {
if (str.charAt(let)=='a') {
image(Alef, width-horMargin+charLocation, vertMargin+lineLocation, fontWidth, fontHeight);
println("a");
};
if (str.charAt(let)=='b') {
image(Bet, width-horMargin+charLocation, vertMargin+lineLocation, fontWidth, fontHeight);
println("b");
};
// Character Location
charLocation = charLocation - fontWidth - kerning;
//println(charLocation);
// checking if it's a new word
if (str.charAt(let)==' ' && t < wordsNum) {
// creatng a new line
if (width-horMargin+charLocation-wordsLength[t]*fontWidth < horMargin) {
charLocation = 0;
lineLocation = lineLocation + fontHeight + leading;
}
t++;
}
// if (width-horMargin+charLocation < horMargin){
// }
}
}
void movieEvent(Movie m) {
m.read();
}
Answers
Add at the beginning of draw():
Kf
thank you! ;)