Skip to content

Instantly share code, notes, and snippets.

@KrabCode
Created August 13, 2017 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KrabCode/92726ee470b930bb282da8392629c0fc to your computer and use it in GitHub Desktop.
Save KrabCode/92726ee470b930bb282da8392629c0fc to your computer and use it in GitHub Desktop.
Text slideshow animator
import com.hamoid.VideoExport;
import processing.core.PApplet;
import processing.core.PFont;
public class MainApp extends PApplet{
public static void main(String[] args)
{
PApplet.main("MainApp", args);
}
private PFont f;
private int i;
private int framesPerString;
private int framesThisString;
private String input;
private String[] split;
VideoExport videoExport;
public void settings()
{
size(1920, 1080);
}
public void setup()
{
videoExport = new VideoExport(this);
videoExport.startMovie();
f = createFont("Arial",42,true);
i = 0;
framesPerString = 3;
//input = "If you are struck by the appearance of any promised pleasure, guard yourself against being hurried away by it; but let the affair wait your leisure, and procure yourself some delay. Then bring to your mind both points of time: that in which you will enjoy the pleasure, and that in which you will repent and reproach yourself after you have enjoyed it; and set before you, in opposition to these, how you will be glad and applaud yourself if you abstain. And even though it should appear to you a seasonable gratification, take heed that its enticing, and agreeable and attractive force may not subdue you; but set in opposition to this how much better it is to be conscious of having gained so great a victory.";
//input = "What the fuck did you just fucking say about me, you little bitch? I’ll have you know I graduated top of my class in the Navy Seals, and I’ve been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I’m the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You’re fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that’s just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little “clever” comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn’t, you didn’t, and now you’re paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You’re fucking dead, kiddo.";
input = input.replaceAll("\n", "");
input = input.replaceAll("\\.", "");
input = input.replaceAll(",", "");
split = input.split(" ");
}
public void draw()
{
background(10);
textFont(f,72);
textAlign(CENTER);
fill(220);
text(split[i],width/2,height/2);
videoExport.saveFrame();
if(++framesThisString > framesPerString)
{
i++;
framesThisString=0;
}
if(i > split.length-1){
i = 0;
videoExport.endMovie();
exit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment