A spinner that keeps spinning

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 257
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: A spinner that keeps spinning

Post by SWEdeAndy » Sun May 07, 2023 12:19 pm

trevix wrote:
Sun May 07, 2023 11:34 am
One more question :?

I resized my web spinner in the IDE and pasted in my standalone.
Running the standalone on iOS, simulator and hardware, the spinner is much more smaller then what appears on the IDE. Like 4-5 time smaller.
On Android the size of the spinner in the standalone is fine.

What could be the problem and is there a solution?
I have not yet tested the browser spinner tech in iOS deployment - it is interesting what you experience when doing so. I have no immediate solution, I'll have to test some myself to see. It may depend on how the different OSes render the browser content. This might mean that some tweaking code is needed to alter the size setting in the htmlText when the platform is "iOS", or something.

This is all in an experimental stage, so I'm happy that your are testing this tech in real situations to find any implementation problems. Maybe I will then be able to improve my tool to provide the user with the necessary remedies for various situations/platforms.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: A spinner that keeps spinning

Post by stam » Sun May 07, 2023 1:24 pm

I wonder if it may be possible to package this into the new script widget?

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 257
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: A spinner that keeps spinning

Post by SWEdeAndy » Sun May 07, 2023 3:04 pm

stam wrote:
Sun May 07, 2023 1:24 pm
I wonder if it may be possible to package this into the new script widget?
Yes, I've been thinking the same. It seems like a good case for that. At the moment the script widget building process still seems rather crash-prone though, so I might wait a little for it to mature another dp or so. But it's definitely on my to-do list to explore.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: A spinner that keeps spinning

Post by trevix » Mon May 08, 2023 6:59 pm

Thanks. Great idea.
The reduced size on iOS instead is a big problem, since is barely visible unless you make it enourmous on Android (my app handle both platform).
Before giving up (or using cumbersome solutions like doubling it), can you tell me if you will be able to explore the problem or else.
Just to know...
I wonder if, since saving the HtmlText in a property, before loading the widget there is a value to be replaced according to the platform.
Trevix
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 257
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: A spinner that keeps spinning

Post by SWEdeAndy » Tue May 09, 2023 10:53 am

trevix wrote:
Mon May 08, 2023 6:59 pm
The reduced size on iOS instead is a big problem, since is barely visible unless you make it enourmous on Android (my app handle both platform).
Before giving up (or using cumbersome solutions like doubling it), can you tell me if you will be able to explore the problem or else.
Just to know...
I wonder if, since saving the HtmlText in a property, before loading the widget there is a value to be replaced according to the platform.
I suppose I'll be able to solve that one way or another. But the solution might in any case be the same as the workaround that I can think of, and which you hint at: To alter the code depending on platform. It wouldn't need to be very cumbersome really:
Either just store two complete sets of code (e.g. as cHtmlTextAndroid and cHtmlTextIos) and set the htmlText of the browser widget to the relevant one.
Or first change the size setting in the code, then updated the browser widget. Depending on which type of spinner you have chosen, you should normally be able to find a size tag near the bottom of the html code.
For the default generic spinners, it's e.g. "style=font-size:64px", so you could just put a placeholder string (like SIZEPLACEHOLDER) there instead of the number, before storing the html code in a cProp. Then, before setting the htmlText of the browser, you put the cProp into a variable, then do 'replace "SIZEPLACEHOLDER" with tValue in tVar', to put in any size you like.

Perhaps you could even find a formula that calculates a suitable size in relation to the width of the screen, or something. I will for sure be exploring this myself too, but currently don't have all the certs/provisioning profiles/Xcode version etc up to date to do any quick iOS tests. So if you have the time to do some testing, it would be valuable to see what you find.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 257
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: A spinner that keeps spinning

Post by SWEdeAndy » Fri May 12, 2023 3:29 pm

Just a note that an improved version has been released:

Version 1.0.4
- More efficient CSS code handling - only CSS code needed for the chosen animations is now included
- Added the possibility to animate text, with various fonts

Web deployed example:
https://wheninspace.com/browseranimation/

Source stack:
https://github.com/wheninspace/WIS_BrowserAnimation
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: A spinner that keeps spinning

Post by jacque » Sat May 13, 2023 5:31 pm

I just had a chance to try this. It's really quite remarkable. Very nice.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 257
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: A spinner that keeps spinning

Post by SWEdeAndy » Sat May 13, 2023 8:55 pm

jacque wrote:
Sat May 13, 2023 5:31 pm
I just had a chance to try this. It's really quite remarkable. Very nice.
Thanks Jacque! Your feedback means a lot to me! :D

Now available:

Version 1.0.5
- Added possibility to copy the code when running the web application (note that a urlDecode() must be done on the pasted text in LiveCode before using it)
- Added possibility to enter an RGB value into the color field (works in the web application too)

So, copying code straight from the web application was a user expectation I realised from the use-list. I've been struggling with getting javascript to cooperate on that one, but only got a half-baked solution so far (ChatGPT failed me this time):
In order to get all of the code (with quotes and line breaks etc) to carry over properly via javascript into the general clipboard, I had to urlEncode it first. This means that if you paste the code into LiveCode, you'll need to urlDecode it first, before setting a browser widget's htmlText to it.
But I'm set on making it work seamlessly in future versions!
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: A spinner that keeps spinning

Post by trevix » Sun May 14, 2023 3:29 pm

Hello. More testings...
I downloaded your last version and prepared a standalone.
On Android (11) hardware, beside the scattering spin, after a few minutes the spinning start slowing down to finally arrive to a complete stop, in approx 5 minutes.
This doesn't happens on OSX and on iOS (where there still is the size problem, but this can be solved as you suggested).
This is my test stack.

Trevix
Attachments
ComplexSpinner.livecode.zip
(46.35 KiB) Downloaded 58 times
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 257
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: A spinner that keeps spinning

Post by SWEdeAndy » Sun May 14, 2023 7:12 pm

trevix wrote:
Sun May 14, 2023 3:29 pm
On Android (11) hardware, beside the scattering spin, after a few minutes the spinning start slowing down to finally arrive to a complete stop, in approx 5 minutes.
That is peculiar. The source site for the animations, loading.css have this info on browser compatibility:

"Loading.css uses CSS Animation and Transform 2D:
- IE <= 9 and Opera mini don't support CSS Animation and Transform 2D.
- Supported but buggy for Android Browser <= 3.
- it works well for all other modern browsers."

Maybe the LC browser widget for Android uses too old technology? I'm afraid it's out of my scope of control, in any case. :(
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 257
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: A spinner that keeps spinning

Post by SWEdeAndy » Wed May 17, 2023 2:00 pm

New cool update:

Version 1.0.6
- The number of iterations can now be set. -1 means infinite.
- Added possibility to enter a url. Link directly to an imagefile on the web to animate it. Or an entire site... :D
NB! If you use a widget animated by url in one of your apps, it must naturally have access to the url destination for it to work.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 257
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: A spinner that keeps spinning

Post by SWEdeAndy » Tue Jun 06, 2023 3:22 pm

Just an update on the browser animation tool, which has had a major upgrade:

Version 2.0 has a new set of 12 modern spinners. They also include a script that enables you to easily change the color of the spinner, and the background of the widget, on the fly, even after copying it to your own stack.

Even if you are not able to use the transparency feature, currently only available in LC10 dp5 on Mac, you can now in any version of LiveCode (since the birth of the browser widget) get rid of the default white background and set it to any color you want.

There is even a feature that will blend in the widget with the (mono-colored) background for you. It uses the mouseColor to pick up the color of the loc pixel behind the widget.

Updated web deployment version here (for demonstration of how it looks and works), now also including a convenient download button for the LC stack, which is the real deal:
https://wheninspace.com/browseranimation/
(Clear your cache or use a private browser window if you don’t see the latest version (2.0).)

The amount of fish is the same… :)
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: A spinner that keeps spinning

Post by richmond62 » Tue Jun 06, 2023 4:27 pm

Wow!

Super!

AND here, for your delectation is your work running in:
-
Screen Shot 2023-06-06 at 6.25.54 pm.png
-
on MacOS 10.7.5:
-
Screen Shot 2023-06-06 at 6.24.57 pm.png
-
Of course colours cannot be changed; but am still impressed how well it works on 'ancient' software.

Oooooh:
-
Screen Shot 2023-06-06 at 6.28.13 pm.png

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: A spinner that keeps spinning

Post by richmond62 » Tue Jun 06, 2023 4:33 pm

Screen Shot 2023-06-06 at 6.32.30 pm.png
-
Screen Shot 2023-06-06 at 6.31.46 pm.png
-
That's a pity.

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 257
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: A spinner that keeps spinning

Post by SWEdeAndy » Tue Jun 06, 2023 5:01 pm

richmond62 wrote:
Tue Jun 06, 2023 4:27 pm
Wow!

Super!

[...]
Of course colours cannot be changed; but am still impressed how well it works on 'ancient' software.
Thanks! :D
Yes, it's cool that it works in (some) older browsers too!

In fact, the colours could be changed, it's just that the OS colour picker doesn't turn up in the browser like it does on desktop.
If you want you can test it on the 'Custom animations" tab where you can type in an RGB value, then press enter or tab:
color.png
color.png (5.42 KiB) Viewed 4417 times
Nevertheless, the web version of this is mostly a gimmick, to give a preview and to show that 90% of the stack actually works out-of-the-box when web deployed. What might also be interesting is to test how far back in LC version history the stack works. I can't remember in which generation of LC the browser widget was introduced? LC 8?
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

Post Reply

Return to “Talking LiveCode”