360º Panorama
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 296
- Joined: Wed May 02, 2012 12:23 pm
- Location: New York
- Contact:
360º Panorama
Hello Dear LiveCoders,
I've been struggling with this problem for a couple of weeks now, but couldn't get it done.
Is it possible to achieve an effect like this one?
Scrolling a group to either side, when reached at the group's border it should continue to be scrolled from other side.
Could anyone direct me to the right way about this?
I've attached a simple example stack. Btw, I know that I can use that javascript code within a browser control, but it's not suitable for me.
I actually bought the linked package, it's a good code. But I know about javascript and/or html5 next to nothing.
So expanding the functionality of it to a level which I need is nearly impossible.
My app should contain hotspots opening some pop-up windows which would have database functionality.
I can't do that via javascript & php & html5.
I need a LiveCode solution for this.
Thanks for any ideas.
Best,
~ Ender Nafi
I've been struggling with this problem for a couple of weeks now, but couldn't get it done.
Is it possible to achieve an effect like this one?
Scrolling a group to either side, when reached at the group's border it should continue to be scrolled from other side.
Could anyone direct me to the right way about this?
I've attached a simple example stack. Btw, I know that I can use that javascript code within a browser control, but it's not suitable for me.
I actually bought the linked package, it's a good code. But I know about javascript and/or html5 next to nothing.
So expanding the functionality of it to a level which I need is nearly impossible.
My app should contain hotspots opening some pop-up windows which would have database functionality.
I can't do that via javascript & php & html5.
I need a LiveCode solution for this.
Thanks for any ideas.
Best,
~ Ender Nafi
~... together, we're smarter ...~
__________________________________________
macOS Sierra • LiveCode 7 & xCode 8
__________________________________________
macOS Sierra • LiveCode 7 & xCode 8
-
- VIP Livecode Opensource Backer
- Posts: 281
- Joined: Sat Jun 04, 2011 5:41 pm
- Location: Switzerland
Re: 360º Panorama
Hi,
normally the trick is to have a part of the "beginning" which is repeated at the "end" and, when you reach this point, you reset the location of the image
Guglielmo
normally the trick is to have a part of the "beginning" which is repeated at the "end" and, when you reach this point, you reset the location of the image
Guglielmo
-
- Livecode Opensource Backer
- Posts: 328
- Joined: Mon Dec 05, 2011 5:34 pm
- Location: Thailand
- Contact:
Re: 360º Panorama
Hi Ender,
It's probably best to have two (or three) copies of the full image side-by-side in a group and you scroll that. At a certain point (not when the edge of an image is visible) you simply move the whole group 1 image width in the opposite direction to the user scroll so that the user cannot see that it happened and so they can continue in the same direction. Apply this to both directions and the user thinks it's infinite.
If your buttons/hotspots are actually in the scrolled group (and there are two copies of each) then they will stick to the 'building' they are over.
If the images are referenced as icons on transparent buttons then you are only using 1 x the memory for the image, so it's still efficient.
The Game Academy (and many, many side-scrolling games of the past!) used this technique for continuous backgrounds.
Cheers,
Dave
It's probably best to have two (or three) copies of the full image side-by-side in a group and you scroll that. At a certain point (not when the edge of an image is visible) you simply move the whole group 1 image width in the opposite direction to the user scroll so that the user cannot see that it happened and so they can continue in the same direction. Apply this to both directions and the user thinks it's infinite.
If your buttons/hotspots are actually in the scrolled group (and there are two copies of each) then they will stick to the 'building' they are over.
Code: Select all
v------------v <-- card width
|------------|------------|
| X | X | <-- hotspots
| | |
|------------|------------| <-- images
The Game Academy (and many, many side-scrolling games of the past!) used this technique for continuous backgrounds.
Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.
Visit http://electronic-apps.info for released App information.
-
- VIP Livecode Opensource Backer
- Posts: 296
- Joined: Wed May 02, 2012 12:23 pm
- Location: New York
- Contact:
Re: 360º Panorama
Hello Dear LiveCoders,
It took me couple of sleepless nights but finally I did it
@ Guglielmo, thanks for idea;
@ Dave, thanks for the solution.
I'm attaching my stack.
It runs on desktop {development}, simulator and device.
* If you want to use it in any of your projects, feel free to.
But, please share any optimizations and add-ons you make.
Sharing is good, mates
* If you find a couple of minutes to test it,
please tell me any glitches you come across to and/or optimization ideas.
Thanks again,
Best,
~ Ender Nafi
It took me couple of sleepless nights but finally I did it
@ Guglielmo, thanks for idea;
@ Dave, thanks for the solution.
I'm attaching my stack.
It runs on desktop {development}, simulator and device.
* If you want to use it in any of your projects, feel free to.
But, please share any optimizations and add-ons you make.
Sharing is good, mates
* If you find a couple of minutes to test it,
please tell me any glitches you come across to and/or optimization ideas.
Thanks again,
Best,
~ Ender Nafi
~... together, we're smarter ...~
__________________________________________
macOS Sierra • LiveCode 7 & xCode 8
__________________________________________
macOS Sierra • LiveCode 7 & xCode 8
Re: 360º Panorama
Noticed that if a building button is selected, after closing the dialog the scrolling is stuck in active mode and requires a click to stop scrolling. (meaning moving the mouse around, even with the mouse up, causes the screen to scroll)
Changed the mousedown handler to fix this.
Changed the mousedown handler to fix this.
Code: Select all
on mouseDown
if the short name of the target is not "button" then -- since all your buttons are named button this works.
put (the mouseH - item 1 of the loc of group "panorama") into kPanoramaX
put the mouseH into kMouseX
put true into kScrolling
end if
end mouseDown
-
- VIP Livecode Opensource Backer
- Posts: 296
- Joined: Wed May 02, 2012 12:23 pm
- Location: New York
- Contact:
Re: 360º Panorama
Hi Sturgis,
I've noticed that it -the faulty code of mine- also prevents the button's native script -in my original app-.
So, thank you twice
Best,
~ Ender Nafi
I've noticed that it -the faulty code of mine- also prevents the button's native script -in my original app-.
So, thank you twice
Best,
~ Ender Nafi
~... together, we're smarter ...~
__________________________________________
macOS Sierra • LiveCode 7 & xCode 8
__________________________________________
macOS Sierra • LiveCode 7 & xCode 8
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: 360º Panorama
Hi Ender,
Nice job. Thank you for share it
I don't know how i did that, but it is possible (desktop)
I have to search every step but the first is a mouseup on a btn (2,3,4,5).
I'm coming back once i have news.
All the best
Jean-Marc
Nice job. Thank you for share it
I don't know how i did that, but it is possible (desktop)
I have to search every step but the first is a mouseup on a btn (2,3,4,5).
I'm coming back once i have news.
All the best
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: 360º Panorama
Hi Ender
I'm not sur the first step is a mouseup on a 2,3,4,5 btns
I found a recipe to produce the mistake.
• repeat 2 times
• Click at the left +4 of the card
Drag to the right of the card + 500
click outside the card
I think you can add a limit in the mousemove handler
Something like that:
Best
Jean-Marc
I'm not sur the first step is a mouseup on a 2,3,4,5 btns
I found a recipe to produce the mistake.
• repeat 2 times
• Click at the left +4 of the card
Drag to the right of the card + 500
click outside the card
I think you can add a limit in the mousemove handler
Something like that:
Code: Select all
on mouseMove pX, pY
if kScrolling then
if pX > the right of this cd or pX < the left of this cd then exit mousemove ## jmb 251112
put (pX - kPanoramaX) into theLeftValue
set the loc of group "panorama" to (theLeftValue & comma & (item 2 of the loc of me))
end if
put pX,pY
end mouseMove
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: 360º Panorama
Hi Ender,
I changed your stack and simplified it a bit.
It avoids the problem Jean-Marc noticed (hi Jean-Marc).
I tried to solve sturgis solution a little differently.
Furthermore I saved the stack in legacy (2.7) format since not all the users of the forum use Livecode 5.5 and higher.
Have a look.
Kind regards
Bernd
I changed your stack and simplified it a bit.
It avoids the problem Jean-Marc noticed (hi Jean-Marc).
I tried to solve sturgis solution a little differently.
Furthermore I saved the stack in legacy (2.7) format since not all the users of the forum use Livecode 5.5 and higher.
Have a look.
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: 360º Panorama
Hi Bernd,
Thank for cleaning my dirty way
Your script work fine
Kind regards
Jean-Marc
Thank for cleaning my dirty way
Your script work fine
Kind regards
Jean-Marc
https://alternatic.ch
Re: 360º Panorama
Your way is better bernd, thx for the lesson. It solves another related problem I noticed also.
bn wrote:Hi Ender,
I tried to solve sturgis solution a little differently.
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 296
- Joined: Wed May 02, 2012 12:23 pm
- Location: New York
- Contact:
Re: 360º Panorama
Dave, Jean-Marc, Sturgis; thank you very, very much for all your help.
Bernd, I envy you
Just 30+ lines of code and no faulty or erratic behavior?
I really envy you - in a total respectful way of course -
Thank you very much, all of you.
Best,
~ Ender Nafi
Bernd, I envy you
Just 30+ lines of code and no faulty or erratic behavior?
I really envy you - in a total respectful way of course -
Thank you very much, all of you.
Best,
~ Ender Nafi
~... together, we're smarter ...~
__________________________________________
macOS Sierra • LiveCode 7 & xCode 8
__________________________________________
macOS Sierra • LiveCode 7 & xCode 8
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: 360º Panorama
Jean-Marc, Sturgis and Ender,
thank you for your kind words.
Of course I have to pass on the compliments to all the LiveCoders whose code helped me to learn the language.
A technical comment:
If you use groups when calculating offsets or animations don't forget to set the margins and the borderwidth of the group to 0. Otherwise it will add to the width and height of the group and makes calculating difficult.
If you set the margins and borderwidth of groups to 0 the dimension of the group are the dimension of the enclosed object/s. (something I learned from Scott Rossi's code)
Kind regards
Bernd
thank you for your kind words.
Of course I have to pass on the compliments to all the LiveCoders whose code helped me to learn the language.
A technical comment:
If you use groups when calculating offsets or animations don't forget to set the margins and the borderwidth of the group to 0. Otherwise it will add to the width and height of the group and makes calculating difficult.
If you set the margins and borderwidth of groups to 0 the dimension of the group are the dimension of the enclosed object/s. (something I learned from Scott Rossi's code)
Kind regards
Bernd
-
- Posts: 72
- Joined: Sat Apr 06, 2013 8:09 am
- Location: London
Re: 360º Panorama
Can this be made to work on Android as well?
When I tried to compile an APK File for Android I got the reply not supported on this platform
When I tried to compile an APK File for Android I got the reply not supported on this platform
-
- VIP Livecode Opensource Backer
- Posts: 296
- Joined: Wed May 02, 2012 12:23 pm
- Location: New York
- Contact:
Re: 360º Panorama
There isn't much code specific for mobile.
So, it should work on android, too.
Could you try to remove the stack script and see if it works?
All that compositor settings were unnecessary, already.
And they may cause the issue.
Just setting the acceleratedRendering would be enough.
I can't test it 'cause I don't have android sdk.
Best,
~ Ender Nafi
So, it should work on android, too.
Could you try to remove the stack script and see if it works?
All that compositor settings were unnecessary, already.
And they may cause the issue.
Just setting the acceleratedRendering would be enough.
I can't test it 'cause I don't have android sdk.
Best,
~ Ender Nafi
~... together, we're smarter ...~
__________________________________________
macOS Sierra • LiveCode 7 & xCode 8
__________________________________________
macOS Sierra • LiveCode 7 & xCode 8