Page 1 of 1

Stack of Two - (AS3 Preloader experiment)

Posted: Mon Jan 18, 2010 8:55 am
by erik leeman
Here's a spin-off from my Flash preloader experiments that might be useful for some rare and special applications:

http://tinyurl.com/Pano2VR-Stack-of-Two

It's a 'double whammy', one semi-transparent pano over another, so that both can be seen at once.
Utterly useless as this example certainly is, the fact that it can (easily) be done does open some interesting possibilities I think.

After clicking in the pano window to get the focus, you can pan and zoom both panos in perfect sinc by using the keyboard.
Sadly the mouse only controls the uppermost pano, so the second one doesn't move when using the mouse.

Since transparency and/or visibility of both panos can be controlled through the programming interface, it is also possible to make buttons (or whatever) to instantaneously swap the panos, a that just might be very useful indeed! I'll leave it to your own imagination to think about what you then could do! :D

Cheers!

Erik

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Mon Jan 18, 2010 12:33 pm
by erik leeman
And here's one that lets you switch panos by pressing buttons.
All it takes is an extra .swf file of only 5.12 kB :D
A crude but effective demo I think.

http://tinyurl.com/Pano2VR-Stack-of-Two-Switch


Erik

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Mon Jan 18, 2010 12:56 pm
by HMS Beagle
My first thought is, can windows/openings in the front pano be made transparent? If so is it possible to rotate the back pano at a slightly different speed? Giving the impression of actually looking out the window.
?
G

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Mon Jan 18, 2010 1:06 pm
by erik leeman
HAHAHA! You read my thoughts!

Flash itself can use .png's with transparency, but Pano2VR as it is now not, as far as I know.
If Thomas would let us use .png cubefaces we certainly could make see-through windows and things like that!

Just think of the things you could make....

Cheers!

Erik

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Mon Jan 18, 2010 2:06 pm
by commodore64
nice.

Would mask's works with those?

How about 'linking' the movement?
(for example day & night scenes, switch views or adjust transparency,
and you are looking at the same direction)

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Mon Jan 18, 2010 2:20 pm
by erik leeman
switch views
That's what this simple example demonstrates:
http://tinyurl.com/Pano2VR-Stack-of-Two-Switch

It's all up to your imagination, scripting skills, and the functionality Thomas' API offers, which is a lot, albeit not limitless.
Panning, zooming, transparency, scale, they can all be controlled through Action Script, so you can practically make anything.
How exactly? Well, we'll just have to find out what can, and what can not be done :D

Cheers!

Erik

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Thu Jan 21, 2010 4:55 pm
by erik leeman
Next stage: a fade-in/fade-out transition.
The fading effect can (and must) be refined some more, but at least for now it works :D

http://tinyurl.com/Pano2VR-StackofTwo-SwitchFade

Of course this technique needs to be tested thoroughly to be sure it always works.

Cheers!

Erik

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Thu Jan 21, 2010 7:07 pm
by Robert Harshman
Erik, this is extremely interesting, having pano in layers with all of the layer blending type options and masked transparency would be a major enhancement to say the least. It's something that only one other player that I'm aware of has ever done, and that required shockwave. While you can kind of do this in other flash players today, the movement must be static during the transition.

However, for me the transition in your example is not happening, it's immediate with no blending that I can see.

Using Firefox, beta 10.1 of flash on XP.

Regards,

Robert

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Thu Jan 21, 2010 7:32 pm
by erik leeman
Hi Robert, thanks for having a look.
However, are you sure you used this link?
http://tinyurl.com/Pano2VR-StackofTwo-SwitchFade
The one with SwitchFade at the end?
I only had time to test it on one (rather old) XP machine, but I used several different browsers.
It shouldn't be faster on your computer (with most likely a more powerful processor than mine), because I used a timer for the alpha-changing iterations.
Still I can't be sure I did it properly unless it is tested on a larger number of PCs.

Even if I did get it wrong in this version, I'm sure it will work eventually because the instantaneous swaps work fine, as you already saw.
I really hope we will be able to use PNG's for cubefaces, AND that it will prove to be possible to strictly control which pano is 'on top' of the other. If so, we'll be able to do some pretty interesting stuff I'm sure!

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Thu Jan 21, 2010 9:13 pm
by Robert Harshman
Yes, I tried the fade one, just tried in using Chrome and it kind of fades - less than 1/2 second, no transparency between, kind of a go to dark, load second pano, but all in 1/2 a second or less.

And yes, a fairly powerful computer with a modern Nvidia setup with Cuda.

Regards

Robert

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Thu Jan 21, 2010 9:26 pm
by erik leeman
Thanks again Robert,

On my PC I had to set a ridiculously short delay interval to get a reasonable fading time, so apparently it is a performance-sensitive mechanism in spite of the timer. That's a pity.
I'll increase the interval (in milliseconds), hopefully it will be possible to find value that's usable for most visitors.

Cheers,

Erik

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Sat Jan 23, 2010 1:16 pm
by erik leeman
Just uploaded a 'Stack of Three', and it appears to work well too.
The selection buttons sometimes hang, but I'm sure that can be sorted out.
Here's a link:

http://tinyurl.com/P2VR-StackofThree-SwitchFade

Oh, this time it's Barcelona.

Cheers!

Erik

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Sat Feb 06, 2010 10:44 pm
by erik leeman
YESSS!!! I've solved the non-transparency problem!
Turns out I was very close to a solution all the time, but just needed a hint from the book 'ActionScript 3.0 Cookbook' (O'Reilly) chapter 8.3.

I had this in my AS3 code:

Code: Select all

new BitmapData(1050,1050, true);
which gave a non-transparent background showing through my 'holes',
and all I had to do was to add a transparent background colour like so:

Code: Select all

new BitmapData(1050,1050, true, 0x00ffffff);
Problem solved! :D

I'll make a nice demo a.s.a.p.

Cheers!

Erik

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Fri Oct 01, 2010 5:57 pm
by Noisy
erik leeman wrote:Thanks again Robert,

On my PC I had to set a ridiculously short delay interval to get a reasonable fading time, so apparently it is a performance-sensitive mechanism in spite of the timer. That's a pity.
I'll increase the interval (in milliseconds), hopefully it will be possible to find value that's usable for most visitors.

Cheers,

Erik
Hi guys, this is most interesting thred, I have a suggestion for the fade performance issue,

If I've got it right, when you use a timer rather than an enter frame listener even though the property of the object is changed with each loop the screen is still only updated at the frame rate. So for example if you have a timer that changes the x of a movie clip by 1 pixel 100 times a second and your frame rate is 1 frame per second, what you will actually see is the movie clip jumping 100 pixels every second.

There's two ways to deal with this.
1. Use updateAfterEvent() which forces the player to rerender without waiting for the frame but may have a performance hit
2. Calculate the actual frame rate and change the parameter (x/alpha/whatever) based on what it needs to be when the screen is refreshed by enter frame.

Re: Stack of Two - (AS3 Preloader experiment)

Posted: Fri Jan 21, 2011 5:53 pm
by sportsnapper
Eric,

This looks very much like what I would like to do, though in my case presenting two panos next to each other but with synchronised movement. Any chance you would share your code to give me a head start :wink:

regards


Gareth