javascript - control actions

They have: 330 posts

Joined: Apr 2000

How do I control the order that objects are moved on a webpage? ie - onLoad I want the page to move a poker card from the dealer's location to the player (moving a div). The problem is the actions are all pretty close to simultaneous so it does not look good. How do I pause between cards?

Thanks.

I know this would be a lot easier in flash, but this is a challenge I want to create in html, asp, javascript.

They have: 5,633 posts

Joined: Jan 1970

I'm glad to know someone else knows flash isnt always the answer.

To pause between finction one and function two...
This is the last line of function one:
setTimeout("functionTwo()",100);'
The second value is Ticks. 100 ticks = one second ( I think )

Another realistic visual moveing technique is what flash refers to as "ease". Where the object slows down or speds up slightly before reaching it's destination. That's alot harder to do then one line of code though.

They have: 330 posts

Joined: Apr 2000

Thank you for the help. I will try to use that and see how it turns out.

They have: 330 posts

Joined: Apr 2000

Here is a very basic version of the code that is not working properly for me.

function dealPlayers(){
for(i=0;i<=200;i++){
setTimeout("setCardLoc(p1c1,i,70)",200);
}
}

function setCardLoc(cID,nLeft,nTop){
cID.style.left = nLeft;
cID.style.top = nTop;
}
'

After 2/10 of a second the card shows up at top=70 and left=200. Shouldn't it move 200 times between the start and end of this loop waiting 2/10 of a second each time?

They have: 330 posts

Joined: Apr 2000

I figured it out... thanks

They have: 5,633 posts

Joined: Jan 1970

Glad I could help!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.