Friday, May 25, 2007

Editting Audio in Flash

A question that pops up pretty consistently on the Cold Hard Flash message board is how to edit audio clips in Flash. Lets say you have a 4 minute song you're making an animation for and you'd like to chop the audio into a bunch of sections so that you can split the video up between multiple Flash files.

The best way is to use an audio editing program, but if you're like me and don't own one, here's a work around.

First, and foremost, import your audio.

Find what frame where you'd like to break the audio, create a new layer, and put a blank keyframe at that point.
Go back to frame one. Copy the first frame of the audio and paste it into the new layer
As you can see on the new layer, the audio now ends where you'd like it to begin.
Select the audio in the new layer, bring up your properties panel and click Edit
This will bring up the Edit Envelope dialogue box. Click on the zoom out icon until you see a vertical gray line running through the levels.
That gray line shows you where your piece of audio ends, which just so happens to be that blank keyframe we made earlier, so that gray line is also showing you where you want your audio to begin.

In between the left and right channel levels, there is a small gray bar that you can drag around. That bar tells flash where to start playing a piece of audio. So just drag the bar to the gray line.
Hit okay. Now back on the stage grab the newly edited piece of audio and have it start at the blank key frame you created earlier.
As you can see, we are close but not quite. Here comes the annoying part. First, in order to see the audio better, right click on each layer, choose properties and under the layer height pull down, select 300.
And if you want to be really picky (which I do), select large frames under the timeline's drop down menu.
Now go back in and refine the starting point of your new audio clip. As you can see on mine, the new clip starts a bit early so I need to push back the starting point.

Since these are small adjustments you are going to want to be zoomed in pretty tight in the audio Edit Envelope. Navigating the Edit Envelopes timeline and zooming in can be really annoying. Here's how you can find your starting point and easily zoom in on it.

First zoom out wide and scroll so that the starting point is all the way to the left on the timeline's visible section, and then zoom in. While zooming in with the Edit Envelope, the frame on the left stays put.
Now adjust your staring point. You want see the edit take place on the stage's timeline until you hit okay (very annoying), so this will probably take a few tries to get it right. You won't get it perfect but with a little patience you can get really really close.
Collapse your layer heights, zoom out on the timeline and you're good to go
When you hit play it won't sound perfect, you'll get a slight tinny echo, but for timing purposes and lipsync you'll be fine. You can go and copy that new piece of audio and place it in a new document.

Wednesday, May 23, 2007

Multiplaning Looping Panning Backgrounds

This tutorial is a continuation of the previous lesson on creating looping panning backgrounds.

Update: I am now offering this tutorial's FLA for 3 dollars through PayPal. Currently it's only available for Flash CS3 and up, but if there's demand I can make it for other versions as well. The FLA includes the looping background pan and the multiplaning looping background pan.




E-mail address you'd like to receive .ZIP file (25 kb)




So we left off with this








But that's not impressive enough for you. The kids love that 3D stuff, so lets give them some multiplaning action.

The loop we've already made will be the back most, slowest moving plane in our pan. Everything else will move faster. So when making a multiplane shot, make sure the first loop you make is your farthest back (the sky, or in this case, the wall.)

Now lets take a look at the two symbols we've made so far
background_pan contains the motion tween that makes the background move
background is the drawing that is the background.

What we need to do now is make duplicates of both these symbols to hold some new drawing. First thing I'll multiplane are paw prints running over the ground. So copy the instance of background_pan that starts on frame 51 and paste it in place on a new layer.
Now duplicate the symbol background_pan and call it footstep_pan.



Enter footstep_pan, duplicate background and call it footstep. You probably have sync and snap on, so when duplicating background you'll have to do it on the first frame on the timeline, but when we go inside footstep you'll want to do it on your middle frame. Also DO NOT ALTER THE TIMING OF THE MOTION TWEEN.

Go inside footstep, make a new layer to draw in, delete the background layer, unlock the mask and turn the mask to outline (this way you can see your boundaries but it doesn't cover what you're drawing). On your new layer make your new drawing. In my case, I'm making footprints. As you can see I made sure they were flush with the boundaries of the mask.


Now let's go back to the stage and play this.








As you can see we have a few problems. The footsteps appear only half the time, and more importantly, there's no multiplaning. What kind of multiplaning tutorial is this?

Let's fix the multiplane problem first. And it's such a simple fix. On the stage select footstep_pan, hit ctrl+alt+s to bring up the Scale/Rotate dialogue box, and scale it up somewhat. The amount you scale this symbol up determines the increased speed of this plane's movement. If you want a subtle multiplane, scale it up a bit. If you want a big increase in speed, scale it up a lot. The footsteps should be subtle so I'm only scaling it up a bit (the screenshot says 105%, but I eventually settled on 110). Also it's important when scaling the _pan symbols to either use the scale/rotate dialogue box, or make sure that it's scaling relative to the symbol's center point.

Now that we have the footsteps moving faster, let's fix the problem of it only appearing half the time. Select footstep_pan copy it and paste it in place on a new layer, then select the new instance and put its starting frame on 1.

Now let's check it out.








It's working, but there are a few problems. First of all, it's super subtle, but that's okay we'll do more impressive stuff in a bit. And second, sometimes you want objects to multiplane that don't run the course of the entire screen. Maybe you want to add something like a piece of cheese.

Cheese? What a great idea, let's do that. Copy the footprint_pan instance that starts on frame 51, paste it in place on a new layer. Duplicate footprint_pan and call it cheese_pan. Enter cheese_pan, duplicate footprint and call it cheese. Enter cheese, delete out the footprint drawing and draw a piece of cheese.

Now go back out to the stage. Now your cheese is moving at the same speed as the footprints. To fix that just scale the cheese up some more using the scale/rotate dialogue box. You probably won't like the verticle placement that happens when you scale-up the symbol, so just adjust that placement to something you like. ONLY MOVE THE SYMBOL TO ADJUST VERTICLE PLACEMENT, DO NOT MOVE THE SYMBOL LEFT OR RIGHT (this will make sense in a bit).

Now here is what we have








Getting better, but let's say you want more than one piece of cheese, and you want to adjust the starting spot for the piece of cheese that is already there. To change the starting spot, just change which frame cheese_pan starts looping on. To add another piece of cheese, just copy cheese_pan, paste it in place on a new layer and adjust the starting frame. My two instances here start on frame 80 and 45.

And here's what that looks like






For the sake of this tutorial I'm going to do a bit more mutliplaning, but in order to do that, I think I need more ground to play with and less wall showing. That's an easy fix, just select everything and move it up a bit. Then select just the footprint_pan instances and move those down, and then select the cheese_pan instances and move those down even more.

Now that we have more ground to play with, lets add some more cheese, this time between the wall and the footprints. Easy enough, just copy an instance of cheese_pan and scale it to a size that is somewhere between the scale of the wall (100 %) and the footprints (110%), and then vertically place the new cheese between the wall and the footprints. To tell what percentage your symbols are scaled, bring up the transform dialogue box (ctrl+t). Once you have the placement for the cheese correct, you can add more cheese on that plane by copying it, pasting it in place and changing the starting frames. In the screenshot bellow I also added another piece of cheese closer in the forground using the same technique (except I scaled the cheese_pan instance larger instead of smaller).

And here it is playing







A thoroughly ridiculous background, but you get the point. And of course you don't have to be limited to cheese, you can keep making more duplicates for other objects like chairs, or whatever your little heart desires. I decided this long, fermented dairy loving hallway needed some illumination, so I also added some lightbulbs comming in from off screen. It's a little stupid since realistically speaking these lightbulbs are way too low, and the forground lightbulbs are actually closer to the ground than the background bulbs, but what do you want from me, I was making this up as I went along. Normally I would have figured out my horizon line to determine the verticle placement and height for all the objects before doing any of this.

But enough excuses, here it is, my final multiplane.







And remember, I am now offering this tutorial's FLA for 3 dollars through PayPal. Currently it's only available for Flash CS3 and up, but if there's demand I can make it for other versions as well. The FLA includes the looping background pan and the multiplaning looping background pan.




E-mail address you'd like to receive .ZIP file (25 kb)



Tuesday, May 22, 2007

Looping Background Pans

Update: I am now offering this tutorial's FLA for 3 dollars through PayPal. Currently it's only available for Flash CS3 and up, but if there's demand I can make it for other versions as well. The FLA includes the looping background pan and the multiplaning looping background pan.




E-mail address you'd like to receive .ZIP file (25 kb)




Last year I was working on a show that had a lot of panning backgrounds. I would spend a lot of time making sure backgrounds would pan and loop correctly, so I decided to come up with a method that would work every time. Using my technique it's very easy to make those Hanna Barbara-esq looping backgrounds. Also, this technique is a good start to making multiplaning pans like this






But let's start simple.

Step 1: Create a paint square (with no stroke) that is larger than the stage. The square you make is almost (but not quite yet) the size of the background drawing you'll end up making, so keep that in mind. You might want something pretty wide, but to make things easier here, I'm making one that is just barely wider than the stage.

Step 2: Align this piece of paint to the center of the stage both horizontally and vertically. You can do this through the Align panel which you can bring up through the hotkey ctrl+k.

Step 3: Symbolize the paint. This symbol will be your background drawing, so call it something clever. I called mine background.

Step 4: Symbolize the background symbol. This new symbol will contain the motion tween that makes the background pan. I named this symbol background_pan.

Step 5: Enter the symbol background_pan. Then copy and paste-in-place the symbol background twice. Place the first new instance butting up directly on the original instance's left side. Place the second instance butting up on the original instances right side. Only move these instances horizontally, and you might want to turn snapping on, to make sure these symbols are actually touching each other.
Step 6: Create a new keyframe farther down the timeline. YOU MUST PICK AN EVEN KEYFRAME NUMBER. The frame number you pick will determine the speed of your background tween. A low keyframe number like 60 will create a very fast background pan. A high keyframe number like 700 will create a very slow pan. For now just guess, you can mess around with it later. I'm choosing 100 because it makes the math easier (there is a little math later on, stop crying).

Step 7: Do you want the background to move left or right? Now is the time to decide. I want my background to move from right to left so on frame 1 I deleted each instance of background except for the right most one. On frame 100 I deleted every instance except the leftmost one. In the screen shot below I am on frame one and have onion skinned the whole timeline.


Step 8: Motion tween the two keyframes. No easing! Here you will get an idea of your pan's speed. Now is the time to make adjustments to the timing by changing the frame number of the second key frame, but remember YOU MUST PICK AN EVEN NUMBER. I'm stubborn so I'm sticking with 100.



Step 9: Big step! Exit background_pan. Now that you're on the stage, make the file's timeline longer than the pan length inside background_pan (you can't show off a background looping if you don't hold on it long enough). Then copy background_pan and paste it in place on a new layer. Then change the starting frame for the new instance following this simple formula: Length of pan divided by two, plus one. Or if you want to look fancy, L/2 + 1. My pan is 100 frames long, 100 divided by two is 50, and adding one to that gives me 51, so my starting frame is 51. Now you see why I told you it's important to pick an even number for your panning length.


Step 10: Make sure both symbols are set to loop and hit play. It almost works! But there's a problem, there is a gap between the two background instances. I honestly have no idea why this happens, but it does. The length of your pan will effect how much of a gap there is. If your pan is fast the gap will be bigger, if your pan is slower, the gap will be smaller. To fix this problem we're going to go into the background symbol and stretch it, but the amount we stretch it will be determined by the speed of your pan, so make sure you like your speed before going any farther.

Step 11: Go inside the background_pan instance whose start frame you adjusted. Go to that new starting frame inside the symbol (But if you're good and are using Enter Graphic at Current Frame you're already right there). Make a keyframe, so that you can now enter the symbol background at that position.
Step 12: Now we stretch the paint. But there's a problem. Normally if you select the paint, hit q to enable free transform, and try to stretch the paint, it only stretches in one direction
Step 13: But if you hold ALT while stretching the paint, it will now stretch from the center, which is what we want.


Step 14: Zoom in really close to one edge and stretch the paint while holding down ALT. You'll notice that the other instance of the background is adjusting as well, this is because you're holding alt so both sides are moving. Stretch the paint so that the instance your adjusting is just touching the tinted instance still outside on the stage.

Step 15: Great! Now we have the exact size the background needs to be, so go and draw your background on a new layer that's above the paint square.

Step 16: There are a couple things you'll notice looking at my background drawing. First of all, it's not a good drawing. That's my fault, I wasn't trying too hard. Second, a bunch of the horizontal lines overshoot the background image size we've established. That'll be an easy fix we'll take care of in a bit. The bigger problem is with the table I've drawn. To place the table where I want it to be, it now WAY overshoots the background boundary. To fix this, just cut out the overshooting part of the table and paste it in-bounds on the other side of the background.

Step 17: To fix the other overshooting lines, take the paint square, bring that layer on top and convert it to a mask

Step 18: Go out to the stage and enjoy your looping background. Here's a swf of mine.







As I said, this technique can also be altered a bit to create mutliplaning pans like this one.







If people are interested I can go into the next steps you'd need to take in order to make the multiplane work.

And remember, I am now offering this tutorial's FLA for 3 dollars through PayPal. Currently it's only available for Flash CS3 and up, but if there's demand I can make it for other versions as well. The FLA includes the looping background pan and the multiplaning looping background pan.




E-mail address you'd like to receive .ZIP file (25 kb)