催眠アプリ

JavaScript

var w = window.innerWidth;
var h = window.innerHeight;
var max = Math.max(w,h);
var r = 0;
var svg1 = document.getElementById("svgField");



var namespace  = "http://www.w3.org/2000/svg";
var ary = [];

var resize = function(){
  w = window.innerWidth;
  h = window.innerHeight;
  svg1.setAttribute("height", h);
  svg1.setAttribute("width", w);
}

var interval = function(){
  //var randomColor = "#" + Math.floor(Math.random() * 16777215).toString(16);
  var l = Math.floor(Math.random()* 12)*5 + 20;
var randomColor = "hsl(300, 100%," +  l  + "%)"
  var round = document.createElementNS(namespace, "circle");
  round.setAttributeNS(null,"cx", w/2);
  round.setAttributeNS(null,"cy", h/2);
  round.setAttributeNS(null,"r", 4);
  round.setAttributeNS(null,"fill", randomColor);
  ary.push(round);
  round.setAttributeNS(null,"r", r);
  svg1.appendChild(round);
  ary.forEach(function(c, i){
    rr = c.getAttributeNS(null,"r");
    console.log(rr)
    rr = Number(rr)+40;
    c.setAttributeNS(null,"r", rr);
    if(rr>max/1.2){
      c.remove();
      //ary.delete(i)
    }
  });
}


document.body.requestFullscreen();
document.getElementById("demo").addEventListener("click", function() {
  document.body.requestFullscreen();
  resize();
}, false);
document.oncontextmenu = function () {return false;}
resize();

for(var i=0;i<24;i++){
  interval();
}
window.addEventListener('resize', resize);

setInterval(function(){
  interval();
}, 90);


//https://echioto.site/
//CV:えちおと!@echioto
var voiceFiles = ['h-voice.mp3', 'h-voice-n.mp3', 'h-voice-a.mp3'];
var voiceAry = [];
voiceFiles.forEach(function(v){
  voiceAry.push(new Audio(v));
});
document.body.addEventListener("dblclick", function () {
  var r = Math.random();
  var i = 0;
  if(r > 0.7){
    i=1;
  } else if(r>0.4){
    i=2;
  }
  var voice = voiceAry[i];
  voice.currentTime = 0;
  voice.play();
  window.navigator.vibrate([20,20,20,20,200]);
}, false);

CSS

html,body{
  overflow:hidden;
}

h1,#code,footer{
  display:none;
}