Gimptalk - Premier Gimp Community: GAP Paths Animation Tutorial - Gimptalk - Premier Gimp Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

GAP Paths Animation Tutorial

#1 User is offline   ccbarr 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 1,705
  • Joined: 23-February 06

Posted 04 May 2007 - 12:32 AM

This tutorial will show you how to make a simple path animation by first making a path and then using GAP to move an object along that path:

Posted Image

Many animations are Path animations. In some of my previous tutorials, I showed you how to essentially create the animation path in the Move Path window. This time, we will be making the Path ahead of time using the Path tool. This approach can simplify the animation process and also simplify making more complex animations. We begin with a simple example.

From the main Gimp toolbox window open a new 400x300px image by selecting:

File | New

Posted Image

Use the settings shown in the above image then click on OK.

From your newly created image window select:

File | Save As

Save this file as background_000001.xcf into the working directory of your choice. It is usually a good idea to make a new separate folder/directory to place your work files into. This is the format one must save a file as (some_file_name_000001.xcf) for working with GAP animations.

After saving the file, return to your image window. We will now add some guides to assist us in making our path. Place your cursor at the top of your image window on the top ruler. Keeping it there, left-click and hold your mouse button down while dragging a guide line down to the horizontal center of your image (which is half of 300 or 150).

Posted Image

Above highlighted in red is the section of your image window to watch as you drag your guide line down. This indicator helps you to properly position your guide line. Drag it down until it states Add Guide: 150.

We will now add two vertical guides by left-click and holding down our mouse button while dragging guide lines from the ruler at the left side of the image window. Drag out a vertical guide line to 50 and then go back and drag out a second guide line to 350 (again use the guide at the bottom of your image window to tell you when your guide has reached the proper position). Your image will now look like this:

Posted Image

Now, from the main Gimp toolbox window select the Paths tool:

Posted Image

In the image window, place the cursor arrow over the left most intersecting guides at point 50,200 (if you look at the guide in the lower left hand corner of your image window, it will tell you when you your cursor is over point 50,200) and click to add the first point (called an anchor) of the path:

Posted Image

As shown in the above image, you will now see a little circle added at the leftmost intersecting guide lines. We have set the first point (anchor) of our path.

Now move the cursor arrow over to the other intersecting guides at the right of your image window at point 350,200 (again rely on the indicator at the lower left of your image window to signal when your cursor is over that point) and click to add a second anchor there.

Finally to complete the path loop, again place your cursor arrow over the guide lines intersecting at the left of your image (at point 50,200) , but this time hold down the CTRL key while clicking on that point:

Posted Image

While it may just seem to be a single line path, in fact it is a closed path consisting of a line connected from the left to right anchor, and then a line connected back from the right to the left anchor. This closed path allows us to create a looping animation where an object will be moved from the left side of our screen, to the right and then back again.

We will be making a 60 frame animation. To begin the process, in your image window select:

Video | Duplicate Frames

Posted Image

In the window that opens, From Frame and To Frame are left at 1 because we only have one frame so far which is background_000001.xcf. We need to give N times a value of 59 because we have 1 frame and we need 59 more to make 60. After adjusting the settings, click OK. GAP will now create 59 duplicates of our background_000001.xcf image and save them in sequentially numbered fashion in our working directory/folder.

From the main Gimp toolbox window, select:

File | New

This time set the Width and Height values to 50:

Posted Image

Click OK. Using the Bucket Fill tool, or by dragging the Foreground color from the color squares in the main Gimp toolbox window to the 50x50 image window, fill the new image with a color. I have chosen blue 0000ff for those who wish to follow along with the tutorial:

Posted Image


Next return to the background_000001.xcf image and select:

Video | Move Path


Posted Image


In the Move Path window click on Instant Apply as highlighted above (letter A) so you can see what is happening in the preview area. Your Source Image/Layer (B) will be the blue square image that you made if you are following along with this tutorial. If it is not selected, click on the drop down box and select it from whatever choices you may have available to you. (If you only have background_000001.xcf and the blue square image open, that will be your only choice.) For Step Mode © click on the drop down box and select None. Choose Center from the drop down box for Handle (D). Hold down your Shift key while clicking on the Grab Path button (E). This will grab the closed path that we made earlier, convert it to an animation path for our blue square image object to travel along, and create a point (keyframe) at regularly spaced intervals on the path for every frame of the animation. This is nice, since in previous tutorials, we had to create our own points (keyframes) using the Add Point button, but we bypass all of that using Paths that are made ahead of time. (Note: if you hover over the various buttons in the Move Path window with your mouse cursor, a small explanation of available options will show for some such as the Grab Path button.)


Our animation is now set up. It is always a good idea to preview the animation before clicking OK in the Move Path window. The reason for this is, what if we did not set everything properly? The preview would show this and allow us to go back and make any needed changes before finalizing this step. (Things done with Move Path are not easily undone, this is why it is important to preview your animation before clicking OK)

Click on the Anim Preview button (F). There will be a window that opens, select Exact Object on Frames and then accept the other default values and click OK:

Posted Image


After some processing, a small preview window will be created. Play the animation to make sure it runs properly (it may not run smoothly, but we will set the frame rate later). Then when you are satisfied, close the little animation preview and also close out the little image window that gets created along with the preview and select Don't Save from the window that opens.

If your animation plays properly (the blue square should move from left to right and then back again) then click OK (G) in the Move Path window. GAP will now add the square image as a new layer into each frame.

What GAP has done is to add the blue square image to the appropriate position in each frame of the background image frames so that when the sequence of images is played, it appears to be moving. Before creating our animated GIF image, we must convert the Frames to a single multilayered image (since a GIF animation is a multilayered image).

From the background_000001.xcf image window select:

Video | Frames to Image


Posted Image

Change the default frame delay value from 41ms to 16ms (to make the animation smooth for this situation) (do not leave a space between the number and the ms; you want 16ms not 16 ms) in the Layer Basename section and click OK. This will create a new 60 layer image. Each layer is one frame of the animation.

From the new multilayered image window that is created select:

Filters | Animation | Optimize (for Gif)

This will result in yet another new multilayered image being created. We run the Optimize function to try to minimize our final animation file size. From the image window created by the Optimize function select:

File | Save As

Save your file as path_anim.gif in your working folder/directory.

The Export window pops up. Select Save As Animation in that window:

Posted Image


Then click the Export button.

Another window will open. Accept the defaults in that window and click OK. Your animated GIF image has been saved. Try opening it in your browser of choice and watch it play.

Closing Notes

On a final note, you can see that the square moves back and forth at a fast speed. I selected a fast frame rate to keep the animation reasonably smooth looking for sixty frames. As an exercise, you might want to do the tutorial again, but using 180 frames instead of 60. This will slow down the objects motion (since it has to travel the same distance, but over more frames), but will keep the animation fairly smooth. Also, we could reduce our file size even further by starting out with the background_000001.xcf image only being 150px in height instead of the 300 that was used. Or one could use the crop tool properly applied to the final optimized image window before saving it as a Gif animation file.

Additionally, we used a simple linear path for our animation, but you can attempt to create different types of closed paths to experiment with. Maybe a triangular path, or a path with curves in it. Feel free to experiment. Try using a path that is not a closed loop and see how that affects your animation. Try animating different objects. Maybe an image scaled down to an appropriate size as an example, or some text. In the tutorial above, try experimenting with pressing the Rotate Follow button once you have completed the Grab Path portion of the tutorial. That will have it's own effects on the animation. The possibilities are endless.

Once you have completed your animation, it is a good idea to delete the xcf files or others from your working folder to avoid filling up your hard drive.

Finally, here is the animation we created, but using 180 frames (still with a 16ms frame delay):

Posted Image
0

#2 User is offline   XyllyX 

  • Newbie
  • Pip
  • Group: Retired Staff
  • Posts: 3
  • Joined: 14-June 05

Posted 06 May 2007 - 06:54 PM

THIS I have to try! Thanks a bunch!!!!!!

Edit: Tried it...that is just too cool! Makes doing move paths so much easier. Thanks again for posting this. Hmmm....I wonder how this would work for doing a "cutout animation", I bet it would be quite handy.

Posted Image
0

#3 User is offline   omgitzkane 

  • Member
  • PipPip
  • Group: Members
  • Posts: 123
  • Joined: 11-April 06

Posted 30 October 2007 - 12:07 AM

great tut! here's my result of my 1st attempt:
Posted Image



it came out a little fast (i only used 16 frames), but i do have a better grasp of the GAP now.
Posted Image
0

#4 User is offline   ccbarr 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 1,705
  • Joined: 23-February 06

Posted 02 November 2007 - 02:11 AM

omgitzkane,

Thank you for trying the tutorial. Very nice results for your first attempt. Glad that it helped you to understand GAP better as well.

:h:
0

#5 User is offline   kane 

  • Member
  • PipPip
  • Group: Members
  • Posts: 35
  • Joined: 25-February 06
  • Locationcali

Posted 23 January 2009 - 11:46 PM

i was looking for this...
0

#6 User is offline   Oregonian 

  • Retired Staff
  • PipPipPip
  • Group: Retired Staff
  • Posts: 2,360
  • Joined: 13-November 07

Posted 24 January 2009 - 01:30 AM

I can't stay out of these GAP tutorials. I forget about them, then come back and find one I haven't tried.

I had good success with the square moving back and forth so decided to use a filled circle on a curved path having a swinging pendulum in mind.

Well I got it to swing one way. I'm wondering if I have to pick up each point in the path on the way back to the left to get it to follow the curved path swinging back to the left.

I ended up with the circle moving back to the left in one straight line in one frame. I just now thought as I was typing this that I should put the circle on the right most point and get the path again. ... and putting another point at the beginning ... ?

Back to the drawing board.
Posted Image
Posted Image
0

#7 User is offline   Oregonian 

  • Retired Staff
  • PipPipPip
  • Group: Retired Staff
  • Posts: 2,360
  • Joined: 13-November 07

Posted 24 January 2009 - 03:27 AM

None of what I was thinking up there worked. The curved path had to be closed to make the pendulum swing back to the beginning.

I made a 3-point path, and closed it. Pulled the bottom (straight) one down into a curve. Then pulled the point at the top down to the bottom one and curved it as best I could to fit the first curve. It works. There's probably a way to do it better but here are my results. I made 30 frames to cut down on bandwidth.

It looked much better on my hard drive when I played the animation than it looks in here.

EDIT: first image dumped. Didn't add anything constructive.

New image. 60 frames, 60ms. Circle semi-flattened before using. Did not optimize - afaic optimizing doesn't improve the image, sometimes makes it worse.

Now I need to figure out how to suspend it from a string. This would be a way to add a pendulum to a clock image.

Posted Image
Posted Image
Posted Image
0

#8 User is offline   Oregonian 

  • Retired Staff
  • PipPipPip
  • Group: Retired Staff
  • Posts: 2,360
  • Joined: 13-November 07

Posted 24 January 2009 - 03:00 PM

At the time when I was really trying to learn GAP I think I probably looked at this tutorial and because I had not used paths very much I was intimidated by them so I passed it up. Now I've learned to really like paths and this one was a very good learning experience about paths in GAP. :mrgreen:
Posted Image
Posted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic