


Demo.prototype.sceneIntro = function () {
  this.setScene('intro');





  this.loader.addAnimation({
    light: {
      type: "Ambient",
      properties: { intensity: 2.5 }
    }
    , "color": [{
      "r": 0.8, "g": 0.8, "b": 0.8
    }]
  });

  this.loader.addAnimation({
    light: {
      type: "Directional",
      properties: { intensity: 1.0 },
      castShadow: true
    }
    , "color": [{
      "r": 0.8, "g": 0.8, "b": 0.8
    }]
    , position: [{
      x: .5,
      y: .5,
      z: .5
    }]
  });



  this.loader.addAnimation({
    visible: () => Sync.get('Objects:TwirlVisible') > 0.1,
    shape: {
      type: 'PLANE',
      width: 2,
      height: 2,
      widthSegments: 4,
      heightSegments: 4
    },

    perspective: '3d',
    scale: [{ uniform3d: 15.25 }],
    color: [{ r: 1, g: 1, b: 1, a: 1 }],
    material: {
      map: 'img/acitwirl.png',
      blending: 'CustomBlending',
      transparent: false,
      depthWrite: false,
      depthTest: true
    },
    angle: [{

      degreesZ: () => getSceneTimeFromStart() * 75,
    }],
    position: [{
      x: ()=>Sync.get('Objects:TwirlX'),
      y: ()=>Sync.get('Objects:TwirlY'),
      z: -25
    }],
    shader: {
      fragmentShaderPrefix: `
          uniform float time2;
          uniform float modulo;
        `,
      fragmentShaderSuffix: `
          float scanline = mod(floor((time2+vMapUv.y)*100.0f), 2.0f);
          if(scanline <0.01) discard;
        `,
      variable: [
        { name: 'time2', value: [() => 0.1 * getSceneTimeFromStart()] },
        { name: 'modulo', value: [2.0] }
      ]
    }
  });

  this.loader.addAnimation({
    visible: () => Sync.get('Objects:TwirlVisible') > 0.1,
    shape: {
      type: 'PLANE',
      width: 2,
      height: 2,
      widthSegments: 4,
      heightSegments: 4
    },

    perspective: '3d',
    scale: [{ uniform3d: 15.25 }],
    color: [{ r: 1, g: 1, b: 1, a: 1 }],
    material: {
      map: 'img/acitwirl.png',
      blending: 'CustomBlending',
      transparent: false,
      depthWrite: false,
      depthTest: true
    },
    angle: [{

      degreesZ: () => -getSceneTimeFromStart() * 75,
    }],
    position: [{
      x: ()=>Sync.get('Objects:TwirlX')+.1,
      y: ()=>Sync.get('Objects:TwirlY'),
      z: -24
    }],
    shader: {
      fragmentShaderPrefix: `
          uniform float time2;
          uniform float modulo;
        `,
      fragmentShaderSuffix: `
          float scanline = mod(floor((time2+vMapUv.y)*100.0f), 2.0f);
          if(scanline <0.01) discard;
        `,
      variable: [
        { name: 'time2', value: [() => -0.1 * getSceneTimeFromStart()] },
        { name: 'modulo', value: [2.0] }
      ]
    }
  });


  this.loader.addAnimation([{
    visible: () => Sync.get('Objects:TunnelVisible') > 0.1,
    object: {
      name: "obj/tunnel.obj",
    }
    , position: [{
      x: 0.0,


    }],
    angle: [{

      degreesY: () => getSceneTimeFromStart() * -120,

    }]
    , scale: [{ uniform3d:()=>Sync.get('Objects:TunnelScale') }]
  }]);
for (let i = 0; i < 3; i++) {
  this.loader.addAnimation([{
  //  visible: () => Sync.get('Objects:TunnelVisible') > 0.1,
    object: {
      name: "obj/obu.obj",
    }
    , position: [{
      x: 0.0,


    }],
    angle: [{
      degreesX: () => getSceneTimeFromStart() * 30,
      degreesY: () => getSceneTimeFromStart() * -20,
      degreesZ: () => getSceneTimeFromStart() * 10, 

    }]
    , scale: [{ uniform3d:()=>Sync.get('Objects:CubeScale')*i }]
  }]);
}

for (let i = 0; i < 15; i++) {

  this.loader.addAnimation([{
    visible: () => Sync.get('Objects:CubeTunnelVisible') > 0.1,
    object: {
      name: "obj/tunnelcube.obj",
    }
    , position: [{
      z:()=>-4*i + ((i*1/20+getSceneTimeFromStart()*1)%1)*20

    }],
    angle: [{
      
      degreesZ: 45+i*360/20
    }],
    scale: [{ uniform3d:1.0 }],
    
  }]);
}

};

