Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Spinning TImage at different speeds?
Thu, Oct 22 2015 8:57 PMPermanent Link

PA

Hello,

I need a SPIN animation for TImage, it should look for example like this:

http://vignette3.wikia.nocookie.net/uncyclopedia/images/a/a3/Spin-arrows.gif/revision/latest?cb=20080914120913

Unfortunately, there is no Spin animation.

Of course I could use an animated GIF, but I need the spin to have different speeds changed dynamically by a control at run-time.

Is this possible?
Fri, Oct 23 2015 7:08 AMPermanent Link

Uli Becker

> I need a SPIN animation for TImage, it should look for example like this:

Have a look here:

http://preloaders.net/en/circular

You can change all settings (speed included) and export it as sprites.
Then just load the sprite image into a TAnimatedIcon.

Uli
Fri, Oct 23 2015 3:12 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

PA,

<< Of course I could use an animated GIF, but I need the spin to have different speeds changed dynamically by a control at run-time. >>

Uli's recommendation is correct.  However, you can only dynamically change the spin speed of a sprite-based animation by changing the number of sprites.

If you want more control over the animation, then I would suggest using the TPaint control and the canvas functionality to animate the spinner completely in code.  Here's an example of how you would do it:

http://stackoverflow.com/questions/17411991/html5-canvas-rotate-image

You can create a TImageElement (WebUI unit) without a parent element (off-screen image), set its URL property to load the image, and then just start rotating/animating it as you like by drawing it.  Look at the WebSlide unit to see how to use the browser's JS animation frame support to do so, specifically these methods in the TSlideShowControl class:

        procedure AnimateHandler(AStartTime: Double);
        procedure BeginAnimation;
        procedure CancelAnimation;

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Oct 23 2015 5:06 PMPermanent Link

PA

Uli Becker wrote:

> Then just load the sprite image into a TAnimatedIcon.

Thanks for the answer. But how can I load an image into a TAnimatedIcon? The TAnimatedIcon.Icon property contains only some built-in state-icons.
Fri, Oct 23 2015 5:20 PMPermanent Link

PA

Tim Young,

it would be VERY NICE if you could provide an example project for this. Thank you!
Fri, Oct 23 2015 6:04 PMPermanent Link

Uli Becker

> Thanks for the answer. But how can I load an image into a TAnimatedIcon? The TAnimatedIcon.Icon property contains only some built-in state-icons.

That's right. You have to add the image to the TIconLibrary interface.
The interface allows to store static and animated icons.

Uli

Fri, Dec 21 2018 5:11 AMPermanent Link

Allen Hunt

Uli,

> Have a look here:
>
> http://preloaders.net/en/circular
>
> You can change all settings (speed included) and export it as sprites.
> Then just load the sprite image into a TAnimatedIcon.
>

Have you been successful at managing the speed of the sprite using the animation speed feature at preloaders.net?  I have not.  I'm going to try some different preloaders (just maybe the ones I have chosen so far don't work) but every now and then I need one to spin slower and I'm unable to get it to do so.

I can't find a way to adjust the speed with TAnimatedIcon and I don't know if it's easy to adjust the sprite.gif.  Does anyone know if I'm overlooking something?  Thanks!

Best regards,
Allen
Fri, Dec 21 2018 9:16 AMPermanent Link

Allen Hunt

fyi:  I've found a solution where I am able to convert a sprite sheet to an animated gif and specify the duration
Mon, Dec 31 2018 11:55 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Allen,

Please start a new thread instead of reviving old threads.  EWB can change a lot over the years, so often the older posts have outdated information in them that doesn't apply anymore

If you want a control that can actually handle bitmap strips (sprites) for animating icons (and not be required to use an icon font, etc.), please use this control:

https://www.elevatesoft.com/manual?action=viewcomp&id=ewb2&comp=TAnimatedIcon

You have to define the bitmap strip as the background for the icon in the icon library, and then tell the TAnimatedIcon control which direction that the sprites are oriented (from left-to-right or top-to-bottom) so that EWB knows which direction to increment the animation frames.

Tim Young
Elevate Software
www.elevatesoft.com
Image