Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Animations: Open as Layers to Double Animation but Maintain Replace.
#6
(03-09-2017, 12:57 PM)Ofnuts Wrote:
(03-09-2017, 11:00 AM)Seano Wrote: PS: I noticed the Mirror Layers script while I was at the Animation Tools page so I downloaded that too.  I will copy both scripts into GIMP somehow first thing tomorrow, and let you know how it went.

mirror-layers is a different animal, it takes a stack of layers, say ABCDEF and adds above the same stack reversed, minus the ends, so ABCDEF becomes ABCDEFEDCB (making a loop show ABCDEFEDCBABCDEFEDCBABCDEFEDCB...). This is meant to create a complete back-and-forth animation from just the "forth" part. Not really useful for you even for horseshoe orbits.

Hello mate, and sorry I am late.  I got busy with some urgent business yesterday and could not afford any time to work on this project, so I put it off until this morning, and have been hard at work all day.

At around noon I realised that no matter what I did, I could never find a way to get the exact coordinates for the intended orbit of the little 'o', that represents the Moon, by trying to use a mouse pointer to hover over it.

I went back to Javascript and wrote a little function that calculates the exact (integral) x,y values for the ellipse required to plot the orbit of the Moon, and now I have a long Sunday to go, with 696 transparent layers to merge a Moon image, (at the proper rotation being 1 of 348, so it is just a matter of using 1 image twice each time), and add the Earth image in the centre of the transparent layer either before or after the Moon, depending on where they both happen to be at that point in the orbit.


The javascript was not too cumbersome:

Code:
function geores(){
 var pi = 22 / 7;
 var rad= pi / 180;
 var Ta = 5.14 * rad; // float - tilt of axis.
 var Ox = 512;        // int   - x-coordinate of origin.
 var Oy = 256;        // int   - y-coordinate of origin.
 var Rx = 512;        // int   - x-radius of ellipse.
 var Ry = 128;        // int   - y-radius of ellipse.
 var Pe = 696;        // int   - points on ellipse.

 var P = frames[Site.main].document.getElementById('Geom').value;
 var Pd = ( P * 360 * rad / Pe );
 var Px = Ox + ( Rx * Math.sin( Pd ) );
 var Py = Oy + ( Ry * ( Math.cos( Pd ) + ( Math.sin( Pd ) * Math.sin( Ta ) ) ) );
 var answer = 'X = ' + Math.round( Px ) + '     AND     Y = ' + Math.round( Py );

 frames[Site.main].document.getElementById('Res1').value = Math.cos( Pd );
 frames[Site.main].document.getElementById('Res2').value = Math.sin( Pd );
 frames[Site.main].document.getElementById('Res3').value = Pd;
 frames[Site.main].document.getElementById('Res4').value = Ta;
 frames[Site.main].document.getElementById('Geom').value = answer;

 answer='';
 for(g=0; g < Pe; g++){
  var Pd = ( g * 360 * rad / Pe );
  var Px = Ox + ( Rx * Math.sin( Pd ) );
  var Py = Oy + ( Ry * ( Math.cos( Pd ) + ( Math.sin( Pd ) * Math.sin( Ta ) ) ) );
  answer += "Point "+g+": "+Math.round(Px)+","+Math.round(Py)+"\n";
 frames[Site.main].document.getElementById('OUTPUT').value = answer;
 }
}

I am sure I will encounter another problem tomorrow, because I doubt that I can do one layer in under 5 minutes, and I have 696 to do, so I would imagine I will be begging for an answer about GIMP scripting well before this time tomorrow evening.

Goodnight and thanks for your help*. 

* The interleave and mirror are fine scripts to add to my standard GIMP.
Reply


Messages In This Thread
RE: Animations: Open as Layers to Double Animation but Maintain Replace. - by Seano - 03-11-2017, 10:15 AM

Forum Jump: