git @ Cat's Eye Technologies yoob.js / master eg / splash-screen.html
master

Tree @master (Download .tar.gz)

splash-screen.html @masterraw · history · blame

<!DOCTYPE html>
<head>
  <meta charset="utf-8">
  <title>yoob.showSplashScreen Demo</title>
  <script src="../src/yoob/splash-screen.js"></script>
  <style>
#canvas {
    border: 1px solid blue;
    width: 400px;
    height: 200px;
}
#pre { border: 1px solid red; }
  </style>
</head>
<body>

<h1>yoob.showSplashScreen Demo</h1>

<canvas id="canvas" width="400" height="200">
Your browser doesn't support displaying an HTML5 canvas.
</canvas>

</body>
<script>
  var canvas = document.getElementById('canvas');
  var ctx = canvas.getContext('2d');
  yoob.showSplashScreen({
      elementId: 'canvas',
      innerHTML: "<p>Warning: this application displays rapidly changing colours " +
        "and/or shapes and may be unsuitable for those sensitive to light or " +
        "prone to epileptic seizures.</p>",
      buttonText: "I understand -- Proceed",
      onproceed: function() {
          setInterval(function() {
              var r = Math.floor(Math.random() * 256);
              var g = Math.floor(Math.random() * 256);
              var b = Math.floor(Math.random() * 256);
              var fs = "rgba(" + r + "," + g + "," + b + ",1.0)";
              ctx.fillStyle = fs;
              ctx.fillRect(0, 0, 400, 200);
          }, 10);
      },
      background: '#a0a0d0'
  });
</script>