// var renderer = new THREE.WebGLRenderer({ // canvas: canvas, // antialias: true // }); // renderer.setPixelRatio( 2.5 ) var artOpts = { // renderer, useTextureNoise:false, fov: 70, timeScale: 0.9, viewOffset:[ -600, 0 ] } artwork = new Artwork( canvas, './jspm_packages/github/marklundin/toyota2@gh-pages/', artOpts ) window.addEventListener("resize", _ => artwork.resize( canvas.offsetWidth, canvas.offsetHeight )) artwork.start() artwork.resize( window.innerWidth , window.innerHeight * 0.32 ) // Fade In/Out CTA let cta = document.querySelector('#cta') setInterval( _ => cta.style.opacity = ( cta.style.opacity === '0' ? '1' : '0 '), 60000 ) console.log('Starting Receiver Manager'); // handler for the 'ready' event castReceiverManager.onReady = function(event) { console.log('Received Ready event: ' + JSON.stringify(event.data));
let InstallationArtwork = ( canvas, filePath, dpi ) => { let pixelRatio = dpi === undefined ? 1.0 : dpi // Style it let artwork = new Artwork( canvas, filePath, { timeScale: 0.9, useTextureNoise:false, pixelRatio }) // Add a resize handler window.addEventListener("resize", _ => artwork.resize( window.innerWidth, window.innerHeight )) // We want the machine to let randomScene = _ => { let scenes = Object.keys( artwork.app.data.scenes ) let key = Math.floor( Math.random() * scenes.length ) artwork.app.changeSceneByName( scenes[key] ) } let timeOutID = setTimeout( randomScene, 5000 ) let onSceneChange = scene => { if( timeOutID ) clearTimeout( timeOutID ) if( scene === 'default' ) timeOutID = setTimeout( randomScene, 5000 ) } // Start artwork.resize( window.innerWidth, window.innerHeight ) artwork.start() artwork.app.onSceneChange.add( onSceneChange ) cast.then( connect => { connect( APP_ID, NS ).then( api => { console.log( 'Google Cast Extension Available' ) // if( new detect(window.navigator.userAgent).mobile() ){ // let castButton = document.querySelectot('#cast') // castButton.style.display = 'initial' // castButton.onclick = api.requestSession() // } connect( APP_ID, DEBUG_NS ).then( debug => { window.cssSize = ( w, h ) => debug.send({ command: 'resize-canvas-css', value:{ "width": String( w ) + '%', "height": String( h ) + '%' } }) window.terminate = _ => debug.send({ command: 'terminate'}) window.reload = clearCache => debug.send({ command: 'reload', value: clearCache }) }) let send = message => api.send( message ).catch( e => null ) // api.availability.add( m => console.log('availability changed:', m )) api.session.add( session => console.log('session :', session )) // api.message.add( m => console.log('message :', m )) artwork.app.onSceneChange.add( send ) }).catch( e => console.error( e )) }) return artwork; }