Giter VIP home page Giter VIP logo

leanorama's Introduction

Leanorama2 - A new version is in the works

Leanorama2

Leanorama - a jQuery plugin for displaying and navigating Virtual Tours based on panoramic images

Leanorama is essentially abandonware. That means Leandigo is no longer actively developing this. Still, pull requests will be accepted.

What is this

Look at the Demo.

Leanorama started as a client-side infrastructure component of a virtual tour product.

Leanorama allows navigation inside equirectangular-turned-cubic panoramic images on HTML5 websites. As a jQuery plugin, it's easy to embed and configure. It's working on modern webkit browsers, including mobile browsers of iOS 4+ and Android 3+, and IE10.

Features

At the time of writing, Leanorama is the first and only 100% HTML5/CSS3/JavaScript panorama viewer available as a standalone solution. It doesn't require paying for a specific software or service in order to be used.

All you need is some very basic HTML/JavaScript skills, and a cubic remap of an equirectangular panoramic image. You'll be able to create virtual tours supporting:

  • Works on Safari, Chrome, Internet Explorer 10+
  • 3D immersive rendition of cubic panorama images
  • Pitch, yaw and zoom view manipulation
  • Control inputs: keyboard, mouse, touch, orientation (accelerometer or gyro on mobile devices)
  • Yes, that means it works on phones and tablets - you can hold them and look around
  • Controls bar with on-screen buttons (via extension)
  • Hotspots for navigaion, information and links (via extension)
  • Title and description (via extension)

I say "via extension" a lot. That's because you can write your own extensions for leanorama using a very simple API.

Attributions

The implementation is loosely inspired by this three.js demo: http://threejs.org/examples/css3d_panorama.html by mrdoob.

This code is bundled with a slightly tweaked version of Transit by Rico Sta. Cruz

The example loads panoramic photographs by:

HowTo

Required Scripts

Include the required scripts (jQuery, Bootstrap, bundled Transit, Leanorama core) and stylesheets:

<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="js/jquery.transit.js"></script>
<script src="js/jquery.leanorama.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/leanorama.css">

Initialization Parameters

In a script, initialize Leanorama in a DOM element of your choosing:

$('#pano').leanorama({ /* ... params ... */ })
Supported Initialization Parameters
Parameter Type Default Description
sides Array   (required) URLs for the panorama images: [right, back, left, front, up, down]
limit object { top: 85, bottom: -85, right: 999, left: -999 } Field of vision limits in degrees
lon number 0 Initial yaw angle
lat number 0 Initial pitch angle
scale number 1 Initial zoom factor
autorotate number 0 Initial autorotation speed
fading boolean true Enable fade in/out when starting/stopping
mouse boolean true Enable mouse controls
kbd boolean true Enable keyboard controls
touch boolean true Enable touch controls
gyro boolean true Enable gyro/accelerometer controls
delay integer 25 Delay in milliseconds between view updates(frames)

Control Bar Extension

This displays a collapsible controls toolbar at the lower-left corner of the panorama object.

Add the control bar extension and CSS:

<script src="js/jquery.leanorama.controlbar.js"></script>
<link rel="stylesheet" href="css/leanorama.controlbar.css">

That's it.

Infobox Extension

This displays a static box at the upper-right corner of the panorama object with any HTML inside.

Add the infobox extension and CSS:

<script src="js/jquery.leanorama.infobox.js"></script>
<link rel="stylesheet" href="css/leanorama.infobox.css">

Add the following initialization parameter to your parameters object:

Infobox Initialization Parameters
Parameter Type Default Description
infobox string   The HTML that will be inserted to the infobox

Hotspot Extension

This lets you show hotspots on panorama's surfaces for navigation, information, links, or custom actions.

Navigation hotspots require a custom event handler. It can be a really simple function (see Example).

Link and information hotspots work out of the box.

Add the hotspot extension and CSS:

<script src="js/jquery.leanorama.hotspot.js"></script>
<link rel="stylesheet" href="css/leanorama.hotspot.css">

Add the following initialization parameter to your parameters object:

Hotspot Initialization Parameters
Parameter Type Default Description
hotspots Array   Contains hotspot definition objects
Hotspot Definition Object
Parameter Type Default Description
type string 'nav' One of ['nav', 'info', 'link', 'action']
id string   The ID of the hotspot DOM element. In case you want to find it later
face integer   The index of the side on which the hotspot should appear (0..5)
x number   The left coordinate of the hotspot on the face (0..1024)
y number   The top coordinate of the hotspot on the face (0..1024)
name string  

Varies by hotspot type

nav:The string that appears in the tooltip
info:The title of the information popup
link:The string that appears in the tooltip
value string  

Varies by hotspot type

nav:Depends on event handler
info:The content of the popup
link:The URL of the link

Events

There are many. Most are internal events you shouldn't care about. Their names are self-explanatory and you can play with them: leanoramaInit, leanoramaResize, leanoramaResized, leanoramaEngineStarted, leanoramaEngineStarting, leanoramaEngineStopped, leanoramaEngineStopping, leanoramaViewChanged, leanoramaViewTransitionStarted, leanoramaViewTransitionStopped, leanoramaAutorotateStarted, leanoramaAutorotateStopped.

One more useful event for developers would be leanoramaHotspotClick, which is for handling hotspot clicks (DUH!), and leanoramaRefresh which forces restart of Leanorama with updated settings. Check out the example below of how can this be glued together.

Example

This is an example virtual tour configuration script:

var tour = {
    plaza: { // First location: Plaza
        sides: [ // URLs for panorama files
            '/path/to/plaza/right.jpg',
            '/path/to/plaza/back.jpg',
            '/path/to/plaza/left.jpg',
            '/path/to/plaza/front.jpg',
            '/path/to/plaza/up.jpg',
            '/path/to/plaza/down.jpg'
        ],
        hotspots: [ // This location has 3 hotspot: navigation, info with video, and a link
            { // Navigation hotspot which will take you to the Museum.
                type: 'nav',
                face: 0,
                x: 123,
                y: 456,
                id: 'nav-plaza-to-museum',
                name: 'Enter Museum',
                value: 'museum'
            },
            { // Link to the Leanorama repository
                type: 'link',
                face: 2,
                x: 42,
                y: 460,
                id: 'download-link',
                name: 'Download Leanorama',
                value:'https://github.com/leandigo/leanorama'
            },
            { // An info popup with a video
                type: 'info',
                face: 4,
                x: 1000,
                y: 1000,
                face: 0,
                id: 'info-video',
                name: 'That <em>awesome</em> video!',
                value: '<div id="blah" style="text-align: center">\
                    <iframe width="200" height="113" src="http://www.youtube.com/embed/9bZkp7q19f0" frameborder="0" allowfullscreen></iframe>\
                    <br><br>In case you have forgotten about this awesome video, here it is!<br><br>\
                    <a href="http://youtu.be/9bZkp7q19f0" class="btn btn-success" target="_blank">Watch it on YouTube</a>\
                    </div>'
            }
        ]
    },
    museum: { // Second location: Museum
        autorotate: 0.1         // When entering the location, autorotation will start
        sides: [ // URLs for panorama files
            '/path/to/museum/right.jpg',
            '/path/to/museum/back.jpg',
            '/path/to/museum/left.jpg',
            '/path/to/museum/front.jpg',
            '/path/to/museum/up.jpg',
            '/path/to/museum/down.jpg'
        ],
        hotspots: [
            { // A navigation hotspot to go back to the plaza
                type: 'nav',
                face: 2,
                x: 456,
                y: 789,
                id: 'nav-museum-to-plaza',
                name: 'Back to Plaza',
                value: 'plaza'
            },
        ]
    }
};

// Initialize tour at the Plaza
var pano = $('#panorama-container').leanorama(tour.plaza)

// Change location when navigational hotspots are clicked
pano.on('leanoramaHotspotClick', function(e, hotspot) {
    if (hotspot.type == 'nav') $(this).trigger('leanoramaRefresh', tour[hotspot.value]);
});

You can clone a working demo from https://github.com/leandigo/leanorama/tree/gh-pages. It contains a fully-functional configuration script.

Custom Extensions

This is undocumented. If you've gone through the code of the extensions we have here, and still have questions, email us. We'll help.

Known Issues, Bugs and Limitations

  • Doesn't work on Firefox.
  • The 6 cube faces get stretched to 1024x1024px no matter what the original resolution is.
  • Accelerometers on different devices behave differently. Samsung Galaxy series and iPhone 4S and below seem to behave consistently OK.
  • Window resize screws up the perspective. Resize events aren't handled.
  • No fancy preloading of images. Do your own preloading.
  • Desktop browsers have minor glitches with rendering of cube corners, that look like small white gaps. If you know how to fix that, let me know. No, it's not the infamous backface visibility.

... And probably many more.

License

Copyright (c) 2013, Leandigo (www.leandigo.com)

Released under the MIT License. See the LICENSE file for details

Githalytics

leanorama's People

Contributors

lairsdragon avatar ztorage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leanorama's Issues

Gyroscope not working

I've been trying to get the gyroscope to work but there doesn't seem to be a way for me to do so. Is there currently a problem with Gyroscope feature that I'm not aware of?

A little strange in Firefox

not work in firefox,it seems as if the transform of the div is not correct.
also do not respond for the browser resize event,if the browser changes size,the panorama looked so strange.

Not Working in Chrome, Chromium on Ubuntu

I tried chromium-browser 32 and google-chrome 33. The demo page does not work on both of them. I am running ubuntu.

I tried it on android. it works fine. Any ideas why? Thank you very much for this excellent project.

How to invoke jquery.leanorama.controlbar plugin's inside function?

It's easy to call function between different js files which embedd in the same html web pages.
/////////////
$.fn.leanorama.extensions.push(function start() {
.....
// Bind the Left button
$controls.left.bind('touchstart mousedown', $.proxy(function() {
//alert("Bind the Left button");
this.pan_start(-0.7, 0);
show_play();
}, this)).bind('touchend mouseup', $.proxy(function() {
this.pan_stop();
}, this));

   function qfordTest(){
     alert("qfordTest");
     this.pan_start(-0.7, 0);
        show_play();
   }

....
)};
//////////
My question is how to invoke left button anonymous function.
I try:(but it doesn't work)
$.fn.leanorama.extensions.push.qfordTest();

dragging action does't work on Safari of iPhone

I build my project exactly as your article said , it can work well on Safari of Mac ,but the dragging action does't work on Safari of iPhone ,when i drag ,the entire webpage move , as below image shows .but your official demo work well on Safari of iPhone ,how can i fixed it ?
ios 2013-12-13 2 56 12

Help me...plz!

Hi, i ve downloaded and try to run on my local and doesnt work...upload on my server and doesnt work...sure is something i dont understand...hoping to find what is on demo.
Thx to all Kindly regards Emanuele

How to set up leanorama

Hello,
i'm developing my first web page and I need a little help to set up leanorama. I don't know how to initialize this awesome panorama.
I try to put the virtual example tour inside of a iframe but i can't make it work. I'm working on drupal 7 if this can help. Anyone can explain me how configure to start the virtual tour example?

Thanks in advance

Question about "polygonal structure"

I found this amazing tool searching on Google and it fits almost perfectly what I seek. But a colleague asked me whether it would be possible to create not a cube but a multifaceted environment with six or eight sides so we could use more frames and thus get more coverage in the panoramic photos. He is a photographer and want to create montages with photos within these parameters in large environments, such as football stadiums, to create promotional events albums with tools like "you were there? Then find your place in the crowd!".

So the question is: would it be possible to adapt the code so that the horizontal axis accept "four or more" images instead of just four by default?

Leanorama is not showing output

Just now I learned about leanorama and its very interesting to work with. I've downloaded an example and it's worked well in my computer. Based on that example I created my own prog but it's not showing any output. Only blank white screen. I tried it with chrome, firefox and safari, but the output is same. I've modified the example's photo with my own photo and interestingly it worked well. I crosschecked my html and js files with those of example's. Everything is similar, but I don't know why it's not working. Please help me. Thanks in advance.

PS: Sorry for my bad English:)

Information button not working on android

Hi,
we are testing the demo and everything works pefect.
However it seems that there is a problem with the info button "i" next to the elevator.
It does not respond on :
Android 4.4.2 Chrome browser
Can you help?

Best regards,
Nico

Starting position

Is there a way to have the panorama initialise on the front image rather than the back? I guess this could be done by re-sorting the image array?

Question: how to create/take cubic projection photos?

Hi, I tried google, but I failed to find any useful information. I don't know where to ask this question. I found hugin can create panorama photos, but I have no idea if that helps creating cubic projection photos or not. I don't know how to take photos to achieve that too. Are there any useful tutorials or online resources about this? Thank you very much. If this kind of questions should not go here, I am very sorry about it.

Android gyro shaking

Hello i have implemented in a html android app leanorama and the tour works fine, but when i activate de gyro the tour image is shaking continuosly, its seems like its getting always gyroscope events, i have try changing the delay, its improves tbut still the "shake effect". I have tested ina samsung galaxy 3 and a galaxy nexus.

Any ideas ?

Thanks in advice.

Multiresolution

Hi, I think it's mainly important, in order to make this tool very useful and so popular, to make it work well with high res panos.
That means big pics, heavy pics.
Having multiresolution images would make the tool prompter when showing at start and also when zooming.
It could be best if the preloading of higher resolution images could be configurable in order to save bandwidth on mobile devices.

The cube of panorama does not close up in Safari on iOS6

Hello,
I found the cube of the panorama does not close up when I tried to test the demo in Safari on iOS6,which means the panorama showed with some white lines in positions of the cube's sides.
However,it works perfectly in Safari on iOS7 and Mac.

I suppose that there are some different characters between these two Safari to cause this problem.

Thanks for your ideas.

Hotspot Extension's info popup seems not work on ios7

Hotspot Extension's info popup seems not work on iOS7(7.0.3) ,i tested in xcode ios7 simulator,and also tested on the iPad4.

And I used chrome Version 30.0.1599.69 when had a test ,popup's close x button doesn't work too.

Initialization Parameters: lat also not work while lon is ok. (what i did is want to make the initial view of the panorama look down)

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.