08-02-2007, 05:16 AM
|
#1
|
|
|
Simulated Multiplane Camera
Hi guys. Im having alot of trouble and getting really confused with how to make a simulated multiplane camera move.
There are about a hundred tutorials all over the place about scrolling something across screen using _xmouse and alot about easing and etc. Im just not sure how to put it all together.
Let me explain a little more about what i mean. I have a long room say a room in an art gallery. i would like to use the mouse position and the size of my symbol to be relative. so the position of my _xmouse is relative to the xposition on my long symbol.
So instead of just using the mouse to initiate the movment i would like the mouse position and symbol position to be linked. How i thaught about it in my head was to use the stage width and then somehow connect that value to the image width and move it in relative terms.
That being said... how would i also add easing to this effect. so that as the user is nearing the end of the room it slows down to a natural stop?
so ive tried piecing many bits of actionscript together using this site and the tutorials. The "interactive image pan" tutorial is very close to what im looking for. but for the life of me i cant understand how to connect the stage width and symbol width together.
Also i would imagine that creating a longer clip and using the same script on it will scroll faster than the background and give an illusion of depth or perspective.
i was just wondering if anyone can try and help me work it out... ive seen that many _xmouse and stage.width/2 im going crazy.
i realise this is an annoying asked a million times question. but im really looking to create the same old effect with many subtle effects with it such as the easing and perspective and etc.
ANY help you can give me is valuable guys. im so sick of reading tutorials i could really use some human interaction to maybe make it click.
|
|
|
08-02-2007, 06:30 PM
|
#4
|
|
|
Is this the kind of thing you are looking for?
I couldn't upload the source as the image used is quite big - here's the code anyway
Code:
var targetx:Number = 0;
var targety:Number = 0;
onEnterFrame = function () {
targetx = -(((Supper._width - Stage.width) / Stage.width) * _xmouse);
targety = -(((Supper._height - Stage.height) / Stage.height) * _ymouse);
var dx = targetx - Supper._x;
var dy = targety - Supper._y;
vlen = Math.sqrt(dx * dx + dy * dy);
if(vlen < 0.1) {
Supper._x = targetx;
Supper._y = targety;
} else {
dx = dx / vlen;
dy = dy / vlen;
dx *= vlen * 0.2;
dy *= vlen * 0.2;
Supper._x += dx;
Supper._y += dy;
}
}
This goes on the root and assumes the clip you want to scroll about on is called 'Supper'
|
|
|
08-03-2007, 01:08 AM
|
#5
|
|
|
charleh thanks so much for your help... your script is perfect the other script i was using had some weird shaking behaviour. and i can adjust it to suit my needs... im experimenting right now with adding another layer that needs to act differently. i want to try and do alot of this by myself so i dont have to ask so many questions. but thanks man you got the ball rolling for me.
EDIT: Okay well i have looked at the script a bit and am kinda getting lost again ( i cant wait till it jsut *clicks*) just a quick question. if i wanted to loose the y movment what would i have to change? also if i wanted something to scroll without using the stage width and stop when it reached the end of the clip width instead what would i change? that insight should help me to not have to ask anymore annoying questions about this... thanks again charleh your a huge help.
Last edited by aaronv2; 08-03-2007 at 01:20 AM..
Reason: updating post instead of double posting
|
|
|
08-03-2007, 01:28 AM
|
#6
|
|
|
Quote:
Originally Posted by aaronv2
if i wanted to loose the y movment what would i have to change?
|
ive pretty much got that sussed now. it was relatively simple to get happening, cause you have written your script well i guess.
i guess the other part of the question i can simplify... i would just like something to scroll in and instead of using the stadge width just stop moving once it proceeds too far right or left. (the boundary of the symbol) i hope this isnt too much of a bother for you to help me out with. im still looking around kirupa for any scrollable info that can help.
|
|
|
08-03-2007, 07:18 AM
|
#9
|
|
|
Quote:
Originally Posted by darkmotion
If you could turn it into a component like the flashcam, it would be sooooooo amazing.
|
Whats the flashcam dm I'm relatively new to flash  ?
|
|
|
07-21-2008, 08:51 AM
|
#14
|
|
|
You need to just set the picture position to be at negative half it's width/height
so when your movie loads
Supper._x = -Supper._width / 2;
Supper._y = -Supper._height / 2;
Code might not be right though as I've not got Flash installed but you get the idea!
__________________
MS Paint FTW!
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 02:08 PM.
|
|