biG frend -> [Flash] Setting up a Virtual Camera (3/28/2008 19:49:37)
|
Ever wanted to Zoom and Pan with your animation, but the tweening took hours? Well theres a simple solution by using a Vcam. The Vcam is just a movieclip. and whatever is beneath the movieclip is shown to the viewer. Thus if you wanted to zoom you would make the vcam smaller. Anyway Open up flash AS2 if your using CS3. Now I want you to make a square as big as your stage (exactly!) use the properties inspector to make sure everything right.. Make the Fill Color Alpha 100%. Now Draw a small circle this will act as your center cross-hair. Its not needed but its very useful. Select the circle and using the align panel (Window >> Align) Click Align to Horizontal Center and Align to vertical center. These can be found in the first row of the align panel buttons (their buttons 2 and 4) Now select everything and convert it to a MovieClip (F8) name it what ever it does not matter. Put the Registration to the center ( Screenshot I nicked :D, just ignore everything except the registration part Now go into your movieclip. Make a new layer and in the first frames actions write quote:
function camControl() { parentColor.setTransform(camColor.getTransform()); var _l4 = sX / this._width; var _l3 = sY / this._height; _parent._x = cX - this._x * _l4; _parent._y = cY - this._y * _l3; _parent._xscale = 100 * _l4; _parent._yscale = 100 * _l3; } function resetStage() { var _l2 = {ra: 100, rb: 0, ga: 100, gb: 0, ba: 100, bb: 0, aa: 100, ab: 0}; parentColor.setTransform(_l2); _parent._xscale = 100; _parent._yscale = 100; _parent._x = 0; _parent._y = 0; } this._visible = false; var oldMode = Stage.scaleMode; Stage.scaleMode = "exactFit"; var cX = Stage.width / 2; var cY = Stage.height / 2; var sX = Stage.width; var sY = Stage.height; Stage.scaleMode = oldMode; var camColor = new Color(this); var parentColor = new Color(_parent); this.onEnterFrame = camControl; this.onUnload = resetStage; And there you've made your Vcam. just to note I did not write that code, I'm not sure who did I just found it in a tutorial a while back but it is open source. Now to test it, go out of the movieclip and make a second layer. Draw a rectangle or anything really. Now Skip a few frames ahead and make keyframe. Make the same Keyframe on the Vcam's layer as well. Now using the resizer tool decrease the Vcam's movieclip to a smaller size. Now make a Motion Tween On Both layers. press Ctrl+Enter and there you have it.
|
|
|
|