I want to share my sketches with other people or create a link to the sketch to be accessible to anyone. Is it possible to do it?
You could use https://gist.github.com/
Thanks, @soegaard for the reply but I want to export the GIF that is processing code output.
As I am creating Earthquake mapping using Processing and I want to show the output to others.
If you know how can I do this that will be a great help.
float rotx = PI/4;
float roty = PI/4;
float rotz = PI/4;
float angle;
float r = 350;
Table table;
PImage earth;
PShape globe;
void setup() {
size(600, 600, P3D);
table = loadTable("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv", "header");
earth = loadImage("https://i.ibb.co/cwWfPbP/world.jpg");
noStroke();
globe = createShape(SPHERE, r);
globe.setTexture(earth);
}
void draw() {
background(30);
lights();
fill(200);
noStroke();
translate(width/2, height/2);
rotateX(rotx);
rotateY(roty);
rotateY(angle);
angle += 0.005;
shape(globe);
for (TableRow row : table.rows()) {
float lat = row.getFloat("latitude");
float lon = row.getFloat("longitude");
float mag = row.getFloat("mag");
float theta = radians(lat) + PI/2;
float phi = radians(lon) + PI;
float x = r * sin(theta) * cos(phi);
float y = -r * sin(theta) * sin(phi);
float z = r * cos(theta);
PVector pos = new PVector(x,y,z);
float h = pow(10, mag);
float maxh = pow(10, 5);
h = map(h, 0, maxh, 1, 40);
PVector xaxis = new PVector(1,0,0);
float angleb = PVector.angleBetween(xaxis, pos);
PVector raxis = xaxis.cross(pos);
pushMatrix();
if (h <= 10) {
fill(0, 0, 255);
} else if (h > 10 && h <= 20){
fill(0, 255 , 0);
} else {
fill(255, 0 ,0);
}
translate(x, y, z);
rotate(angleb, raxis.x, raxis.y, raxis.z);
box(h, 1, 1);
popMatrix();
}
}
void mouseDragged() {
float rate = 0.005; //velocidad de rotacion
rotx += (pmouseY-mouseY) * rate;
roty += (mouseX-pmouseX) * rate;
}
Use saveFrame() to save each frame as tif.
Then use either “Movie Maker” (see the Tools menu in Processing) to convert the tif images into a
QuickTime moive. Then find some tool to convert to gif.
Alternatively, use ImageMagick to convert directly from tiff images to a gif.
There ist also the VideoExport Library.
It requires ffmpeg but works very nice once everything is installed.
You could probably configurate it to save gifs (not tested, not guaranteed).
Or just convert the exported file in the terminal with a command like this.
ffmpeg -i recording.mp4 result.gif
Hello,
You may run in to this:
I have run in to the same issues.
Creating animated GIFs:
:)