Embed 3D model in annotation popup

annotations
embed
3d

(Valeriodeluca) #1

Hi guys! I can embed image in annotation popup ok with this:


!-[]-(http://www.mymethodisthistory.org.uk/images/categories/scaled/Scallop_shell1_t.jpg)
Can I embed an other 3D model?
I tried this but doesn't work


!-[]-(https://sketchfab.com/models/9205950de4d8414bb3c48ad76311c01b)
Tks
Best
Valerio


Embed models in annotations
(Madalin Berechet) #2

You can use this events to control DOM element nodes content:

api.addEventListener( 'annotationBlur', function( index ) {
console.log( 'Leaving annotation ' + index );
} );

api.addEventListener( 'annotationFocus', function( index ) {
console.log( 'Reached annotation ' + index );
} );

Annotations sync


(Valeriodeluca) #3

Tks Mad, so I can write inside popup(annotation) like this? Tks again

api.addEventListener( 'annotationBlur', function( index ) {
console.log( 'Leaving annotation ' + https://sketchfab.com/models/9205950de4d8414bb3c48ad76311c01b );
} );

api.addEventListener( 'annotationFocus', function( index ) {
console.log( 'Reached annotation ' + https://sketchfab.com/models/9205950de4d8414bb3c48ad76311c01b );
} );


(Madalin Berechet) #4

@valeriodeluca
no, you need to write this inside the javascript of your HTML5 page that loads and display the 3d model and the annotations.
See models here: https://labs.sketchfab.com/experiments/


(Mauricesvay) #5

Embeds are not supported inside annotation at the moment.


#6

But it would be fun to embed a model inside itself :smiley:


(Valeriodeluca) #7

oook....
I'm here, but I don't kown how put my two models address, the big and the small (for popup)





Sketchfab Viewer API example

<!-- Insert this script -->
<script type="text/javascript" src="https://static.sketchfab.com/api/sketchfab-viewer-1.0.0.js"></script>



<!-- Initialize the viewer -->
<script type="text/javascript">
var iframe = document.getElementById( 'api-frame' );
var version = '1.0.0';
var urlid = '7w7pAfrCfjovwykkEeRFLGw5SXS';
var client = new Sketchfab( version, iframe );

client.init( urlid, {
    success: function onSuccess( api ){
        api.start();
        api.addEventListener( 'viewerready', function() {

            // API is ready to use
            // Insert your code here
			api.addEventListener( 'annotationBlur', function( index ) {
			console.log( 'Leaving annotation ' + index );
			} );
			api.addEventListener( 'annotationFocus', function( index ) {
			console.log( 'Reached annotation ' + index );
			} );
            console.log( 'Viewer is ready' );

        } );
    },
    error: function onError() {
        console.log( 'Viewer error' );
    }
} );
</script>



(Madalin Berechet) #8

You have here the code to embed the two models (ore twice the same model, I see.
But you don't have annotations. What do you want to syncronize?


(Valeriodeluca) #9

Tks Mad! I d like open an annotation on first model and in annotation find something clickable (a link, a ahref img..) to start second model. Usually first model is a statue and the second one is a particular of the first


(Madalin Berechet) #10

Please open a topic on "Development and API" category. Then sets 5 annotations in your own model, just annotation without any link inside.


(Valeriodeluca) #11

Ok, here new topic: