I have been working on a different way...just fooling around actually.
This just a semi-failed experiment. don't take too seriously. kinda
new to js . just fooling around.
PROBLEMS
if i reset i to 0
Just adding some comments to make this thread more complete...
One could also include all the callback code in an anonymous function
within the arguments to the animate() function. Like this:
$(elementID).animate(
{opacity:(this.opa),
marginTop:top+'px',
marginLeft:left+'px'
The above post fails due to this:
obj.animate({ opacity:myOpacity}, 500);
animation();
The animation() function will be called immediately each time. It
should be in obj.animate's callback function. That being said, the OP
was asking how to do this without resorting to setTimeout().
To do
Hi everyone,
Thanks for your replies!
I was about to reply to mkmanning and say that his solution would not
work, but I tried it and it does! wow! thanks!
Is this because floatAround(), being declared within function Animation
(), is a closure? So the callback still has access to the local
I get it now. It's simply the normal scope rules. this.callback()
inherits the variables of all the functions above itself in the scope
chain, so var _this can be seen, but this._this cannot -- that would
reference the invocation context of the callback, which is the HTML
element object.
try
$this=$(elementID);
2009/6/7 Bill bill.fisher.oakl...@gmail.com
Hi,
I'm trying to create an endless animation similar to a screen saver,
where an image floats around the screen, fading in and out. I would
like to stay out of the global namespace, so I'd like to use the
callback to
I think you may have misunderstood what I am trying to do. I need to
refer to the instance of the Animation object. Within the callback,
this already refers to the HTML Element.
On Jun 7, 4:40 pm, Gustavo Salomé gustavon...@gmail.com wrote:
try
$this=$(elementID);
2009/6/7 Bill
var obj = $(div):
// i want my objects opacity to go to 1 to 0.6 then follow that pattern
var animeframe = 0;
var myOpacity;
function animation() {
setTimeout(function() {
if(animeframe == 0) {
myOpacity = 0.6;
animeframe = 1;
} else if(animeframe == 1) {
myOpacity = 1;
animeframe = 0;
}
8 matches
Mail list logo