読者です 読者をやめる 読者になる 読者になる

JSでこのブログアイコンのキャラ画像の読み込み

<div id="get_tiruno_img_url_test">
  <div><img/><動くよ!!</div>
  <hr>
</div>

<script>
var tiruno_img_url = {
  "up" : [
    "http://cdn-ak.f.st-hatena.com/images/fotolife/s/surume_Reflection/20170131/20170131020640.png?1485796241",
    "http://cdn-ak.f.st-hatena.com/images/fotolife/s/surume_Reflection/20170131/20170131020639.png?1485796031"
  ],
  "down" : [
    "http://cdn-ak.f.st-hatena.com/images/fotolife/s/surume_Reflection/20170131/20170131004443.png",
    "http://cdn-ak.f.st-hatena.com/images/fotolife/s/surume_Reflection/20170131/20170131004440.png"
  ],
  "left" : [
    "http://cdn-ak.f.st-hatena.com/images/fotolife/s/surume_Reflection/20170131/20170131004442.png",
    "http://cdn-ak.f.st-hatena.com/images/fotolife/s/surume_Reflection/20170131/20170131004441.png"
  ],
  "right" : [
    "http://cdn-ak.f.st-hatena.com/images/fotolife/s/surume_Reflection/20170131/20170131004439.png",
    "http://cdn-ak.f.st-hatena.com/images/fotolife/s/surume_Reflection/20170131/20170131004438.png"
  ]
}
function load_splite_image(url_splite){
  var us = url_splite;
  for(action in url_splite){
    for(var i=0;i<url_splite[action].length;i++){
      var url = url_splite[action][i];
      var img = document.createElement("img");
      img.src = url;
      us[action][i] = img;
    }
  }
  return us;
}

var tiruno_img = load_splite_image(tiruno_img_url);
var test_dom = document.getElementById("get_tiruno_img_url_test");

for(action in tiruno_img){
  for(var i=0;i<tiruno_img[action].length;i++){
    test_dom.appendChild( tiruno_img[action][i] );
  }
}


var counter = 0;
var test_dom_img = test_dom.getElementsByTagName("img")[0];
console.log(test_dom_img);

setInterval(function(){
  test_dom_img.src = tiruno_img.down[ counter%tiruno_img.down.length ].src;
  counter++;
}, 600);
</script>