Preserved Topic: Sliding animation with acceleration & deceleration math? (Page 1 of 1) |
|
---|---|
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-29-2002 10:32
Ok, I'll admit it... |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 01-29-2002 10:56
The poster has demanded we remove all his contributions, less he takes legal action. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 01-29-2002 11:17
The poster has demanded we remove all his contributions, less he takes legal action. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-29-2002 12:50
OK, let me read over this a couple of times and throw togther a little example. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-29-2002 14:18
Well... um.... |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 01-29-2002 14:43
The poster has demanded we remove all his contributions, less he takes legal action. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-29-2002 15:02
Arr.. Not right... humm, Ok Then. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-30-2002 13:12
Well. I haven't managed to make it work any better yet. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 01-30-2002 13:16
The poster has demanded we remove all his contributions, less he takes legal action. |
Bipolar (III) Inmate From: KY |
posted 01-30-2002 13:35
I've been working with the script. I got it to return with the same movement, by changing a couple characters. What I want to do is to have a number of div's in that motion layer and be able to click a link and have it go to that specific section of the div. I can do it going one way if the user goes in order from left to right, but going back and forth, I'm a little confused on. ANy ideas? |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-30-2002 14:04
Ensabanur, This is just a test script I've written to well, test out some ideas. At the moment it's hard coded to to move in only one direction (to the left) so I could test out the math behind it. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 01-30-2002 15:45
position = t^2 for acceleration, or T-(T-t)^2 for deceleration, where T is the total time of the animation, and t is the current time of the animation. Increase or decrease T depending on how much acceleration you want (T doesn't really have to be in real time units, in other words). Multiply the whole thing by a constant to make it go faster or slower overall. |
Paranoid (IV) Inmate From: |
posted 01-30-2002 16:39
I've always been curious about acc and deaccelearations with html . |
Bipolar (III) Inmate From: KY |
posted 01-30-2002 16:59
Drac, |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-30-2002 23:10
galaxal, I always thought having the timeout value as a constant would be better. Keeps it nice and smooth that way. I have a couple of other ideas on how to make the script do what I want it to do but as usual I don't the time to finish it right now. |
Bipolar (III) Inmate From: KY |
posted 01-31-2002 02:43
Can anyone tell me why this doesn't work quite right? I click on one of the links that calls the move(destPos) function and instead of sliding to that certain position it slowly creeps along and never stops. Here's the code. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-31-2002 07:50
Ensabanur, Look at your if / else clause. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-31-2002 09:15
Ok, I'm getting near what I'm after now. It was so much simpler than the stuff I was trying to do last night. It's just simple percentage caculations. It's a little more usefull and generic now. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 01-31-2002 11:08
The poster has demanded we remove all his contributions, less he takes legal action. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-31-2002 12:22
Coolness. I should have fun pulling this to pieces. Thanks so much InI. You rock! |
Nervous Wreck (II) Inmate From: Indianapolis, In USA |
posted 01-31-2002 12:49
Adding fuel to the fire: |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-31-2002 14:03 |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 01-31-2002 15:55
The poster has demanded we remove all his contributions, less he takes legal action. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 02-02-2002 06:00
Very nice InI. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 02-02-2002 10:18
The poster has demanded we remove all his contributions, less he takes legal action. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 02-02-2002 12:45
The poster has demanded we remove all his contributions, less he takes legal action. |
Maniac (V) Lord Mad Scientist Sovereign of all the lands Ozone and just beyond that little green line over there... From: Stockholm, Sweden |
posted 02-02-2002 13:24
Here's another way of looking at this, it avoids the physics of the concept, and gives the same results. (I'm sure it works out the same, just a different way of thinking about it.) Let's say we're at A, and we want to move it to B. Every time we loop through the function, we move half way to B, up till the point where it get's near to 1 pixel difference, at which time we snap to the point B. |
Bipolar (III) Inmate From: KY |
posted 02-03-2002 06:32
What about multiple destinations, like having an A,B,C,D,and E and having the object move between all those destinations, possible not in order. Maybe something like The user is at C but wants to go do B, then to E. Would that require two functions? |
Maniac (V) Lord Mad Scientist Sovereign of all the lands Ozone and just beyond that little green line over there... From: Stockholm, Sweden |
posted 02-03-2002 14:30
I've been doing a lot of pages this way, my current front page has all the bits and pieces constantly trying to get to where they belong, by halving the distance between where they are *now*, versus where they ought to be (with the obligatory 'snap' when they get too close.) Every object is checked in a function that runs on a setInterval(), and I have an array which has values for where it is now, and it's intended goal. The 'where now' value gets updated and then set on the pass through this function, and then of it goes. What you'd need to do using this method is just change the intended goal to the new point 'E' when it finally arrives at 'B'. Using my method, you'd get some strange acceleration/decelleration effects; it'd rush to a point, slow down, then rush to the next. It should definitely be possible. I'd worry about first getting your "go from point A to point B" functions working, and then see about adding enhancements, like changes of direction. If you're good at math (trigonometry?) it'd be cool to use vectors and speed variables, but I always lose it on the sin() cos() bits, heh. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 02-03-2002 17:08
The poster has demanded we remove all his contributions, less he takes legal action. |
Maniac (V) Lord Mad Scientist Sovereign of all the lands Ozone and just beyond that little green line over there... From: Stockholm, Sweden |
posted 02-04-2002 16:03
Heh heh. I was *waiting* for either you or Slime to jump in with some real physics examples, I've got a few different ideas floating around that would require some vector/speed functions to work properly. My little technique is naught but a hack, even though it works for most applications. I still have troubles with altering the vectors, what happens if I am moving in one direction (say 30 degrees, at speed 12) and then have another vector acting upon my object (say a planet with gravity). The Math.sin() trigonometry bits I just don't know the math, bummer. How would I plug in a direction (in degrees) and a speed and then translate that to x/y coordinates? If I had that one bit, I could start doing marvelous things. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 02-04-2002 16:26
The poster has demanded we remove all his contributions, less he takes legal action. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 02-04-2002 16:40
For the record, My brain is now little more then gunk covering my screen and keyboard. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 02-04-2002 16:50
The poster has demanded we remove all his contributions, less he takes legal action. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 02-04-2002 19:37
The poster has demanded we remove all his contributions, less he takes legal action. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 02-04-2002 22:58
Yeah, that makes a little more sense. Although I think I'll need to put the theory to practise and play around with it for a while before I actualy understand what's happening. |
Maniac (V) Lord Mad Scientist Sovereign of all the lands Ozone and just beyond that little green line over there... From: Stockholm, Sweden |
posted 02-04-2002 23:51
Yeppers, I remember that link, and added a bookmark to it, right on my browser window! |
Maniac (V) Inmate From: Brisbane, Australia |
posted 02-05-2002 11:14
Cool! Thanks Doc. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 02-05-2002 13:50
The poster has demanded we remove all his contributions, less he takes legal action. |
Paranoid (IV) Inmate From: 127.0.0.1 |
posted 07-13-2002 08:08
Hey - Dracusis - |