Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 04-13-2009, 03:38 PM jQuery Animate
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
In jQuery is it possible to run two animations at exactly the same time?
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
 
Register now for full access!
Old 04-13-2009, 05:46 PM Re: jQuery Animate
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Yes, though there will be a practical limit if you want quality, since if you have too many processes running it could potentially slow the operation of your browser.

To run two animations, just put two animations in your code. They will not run sequentially unless you make one a callback of another.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 04-14-2009, 12:58 PM Re: jQuery Animate
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
I have 22 players on a graphic football pitch and want to be able to move the ball with the player at the same time!

when i set the animate function, the ball moves and then after a little bit the player follows can i animate the two at the same time?

Code:
 if(ball_left != "" && ball_top != "")
 {
 $("#ball").animate({"left": ball_left, "top": ball_top }, (x * 750), function(){  });
 }
 $(player_shirt).animate({"left": player_left, "top": player_top }, (x * 750));

Last edited by evans123; 04-14-2009 at 01:30 PM..
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Old 04-14-2009, 01:10 PM Re: jQuery Animate
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Like I said, animations happen simultaneously by default. The problem, therefore, must lie elsewhere. I set up a simple demonstration on my website which proves this: http://wayfarerweb.com/animate-example.php
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 04-14-2009, 01:31 PM Re: jQuery Animate
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
is there anyway or any script that allows you to run multiple animations at the same time?

the page with the problem is

http://www.championshipfl.com/match_viewer.php?id=2

press start and watch the animations the ball should be in the center of the player but it moves just infront because the ne animation starts before the other one!

Last edited by evans123; 04-14-2009 at 01:33 PM..
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Old 04-14-2009, 02:25 PM Re: jQuery Animate
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Nothing happened at all for me when I pressed start.

Anyway, as I clearly proved above, nothing special is required to run multiple animations at once. The reason is that the $().animate function only registers an animation, which then happens via a setInterval(), which clears itself once the animation is complete. Not that you need to know this, but it explains why multiple animations may happen without anything special being added to the code.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 04-14-2009, 02:25 PM Re: jQuery Animate
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
kk nothing happens when u use jquery in internet explorer!
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Old 04-14-2009, 02:26 PM Re: jQuery Animate
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Not in Explorer. Using FF3 here.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 04-14-2009, 02:27 PM Re: jQuery Animate
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Ah, it worked for me now. You must have been changing something. Everything seems ok, they both move together. Did you fix it?
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 04-14-2009, 03:03 PM Re: jQuery Animate
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
nope! they both move together but the ball is meant to be in the middle of the player when it moves to top right! but the ball is infront of the player
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Old 04-14-2009, 04:05 PM Re: jQuery Animate
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
So animate the player to the ball, then animate both to the same location on a callback to the original animation. You'll have to calculate an offset based on each item's size, since all you have to go by is top and left, but that should be no problem.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 04-14-2009, 05:57 PM Re: jQuery Animate
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
yeah ive got that already so its in the center of the ball... ok ill give that a try!
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Reply     « Reply to jQuery Animate
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.54225 seconds with 12 queries