Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Starting and Stopping a TextureAnim

Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-06-2007 17:22
Hi all....

have a texture anim that I wish to start and stop... hopefully resuming where it left off! (this is for a count down clock of sorts).

I tried setting the mode to FALSE, but that causes the texture to resize... showing the whole image, instead of the "current frame".

I tried setting the rate to 0, but that resets it to the first frame!


ack... hope there is a solution.


thx,

-Ryder-
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
05-06-2007 18:00
Depending on how precisely you need to determine the frame stopped on, you can store the UNIX timestamp when the animation is started, then when stopped, check how much time has elapsed, calculate how many frames that amounts to, set the animation rate to 0 and the starting frame to the one it was stopped on. Then when started again, start on that same frame at the normal rate.
Gearsawe Stonecutter
Over there
Join date: 14 Sep 2005
Posts: 614
05-06-2007 19:17
please let us know if this works. A long time ago I tried to do this and it did not work. Rotate texture animation has all sort of issues when you try to start and stop it to keep it in sync with other items. But maybe Frame animation is different.
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-06-2007 20:25
lol :!

Well, I'd be happy just to be able to stop the animation!!!

(if anyone knows how... )

thx,

-Ryder-
Ultralite Soleil
Registered User
Join date: 31 Aug 2006
Posts: 108
05-07-2007 08:35
From: Ryder Spearmann
lol :!

Well, I'd be happy just to be able to stop the animation!!!

(if anyone knows how... )

thx,

-Ryder-


Can you post the code where you try to stop the anim? Use the [ php ] [ /php ] tags for easy code reading.
Benja Kepler
Registered User
Join date: 16 Dec 2006
Posts: 53
stopping an animation
05-08-2007 08:41
From: Ryder Spearmann
lol :!

Well, I'd be happy just to be able to stop the animation!!!

(if anyone knows how... )

thx,

-Ryder-


if you have
CODE

llSetTextureAnim(ANIM_ON | LOOP,

etc. to run the animation continuously, then calling the same without LOOP will run the
animation one more time, and then stop:
CODE

llSetTextureAnim(ANIM_ON,
Da5id Zsigmond
Registered User
Join date: 26 Jan 2007
Posts: 34
If you put FALSE where you have the ANIM_ON it will stop.
05-08-2007 12:07
You might be able to use some string variable that could be assigned either "FALSE" or "ANIM_ON" in that position to start/stop/restart the animation.
Benja Kepler
Registered User
Join date: 16 Dec 2006
Posts: 53
using a toggle to start/stop a texture animation
05-08-2007 13:12
Using FALSE works - but the side then shows the whole texture, rather than one of its frames. Looks messy if there are a lot of frames. Using ANIM_ON on its own leaves the side showing one frame.

Here's a script that starts/stops using a toggle, i.e. click it to start, then click it to stop, click to start...etc.

CODE

integer run;
default
{
state_entry()
{
run = FALSE;
}

touch_start(integer counter)
{
if(run)
{ // if running, turn off
llOwnerSay("Stopping");
llSetTextureAnim(ANIM_ON,
0,
1,
10,
1.0,
10.0,
15.0);
run = FALSE;
}
else // if not running, switch on
{
llOwnerSay("Starting");
llSetTextureAnim(ANIM_ON | LOOP,
0,
1,
10,
1.0,
10.0,
15.0);
run = TRUE;
} // end if
} // end touch

}
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-13-2007 23:46
Thanks Benja... but that will not work... sorry to say.

The animation *must* stop at the current frame.

CHanging the frames per second variable to 0.0 causes it to stop sometimes... but not with predictable results.
Storm Thunders
Polyavatarist
Join date: 31 May 2006
Posts: 157
05-14-2007 05:16
Last time I messed with starting and stopping frame animations (with a touch_start event) I noticed a lot of buggy behavior. There was something in the Jira about frame animation textures sometimes displaying the entire thing instead of the frame, but I haven't gone back and worked the whole thing out yet.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
05-14-2007 09:04
There's no way to stop an animation at a specific frame in a multi-frame sequence. Since the animation is all client-side, the server (where the script runs) has no clue what frame it is on, and there's no magic "stop the animation at the next frame" message that the server can send to the client (yet -- feature request it via JIRA, if you want, though).

That said, removing LOOP, as mentioned above, is probably about as close as you can get for now.