More Related Content
More from Keiichi Kobayashi (13)
console.log 装飾 (js祭り 4 25 lt)
- 10. やってみよう
console.log('%c ', 'line-height: 120px; font-size: 80px; background-size: 800px; background-repeat: no-
repeat; background-image: url("https://www.wpcloud.jp/wp-content/themes/wpcloud/images/footer_logo.png");');
- 11. アニメGIF (デモ)
console.log('%c ', 'line-height: 120px; font-size: 80px;
background-size: 32px; no-repeat; background-image: url("http:
//bbsimg.ngfiles.com/3/22805000/ngbbs4dd4532014dc7.gif");');
- 12. ウェーブ (デモ)
https://gist.github.com/kobake/6d8d3c71f940bbd49da2
function hex2(n){
var ret = Number(n).toString(16);
if(ret.length < 2)ret = '0' + ret;
return ret;
}
function rgb(r,g,b){
return '#' + hex2(r % 256) + hex2(g % 256) + hex2(b % 256);
}
var Ball = function(index){
this.x = 0;
this.index = index;
this.time = index * 10;
this.color = rgb(80 + index * 8, 50 + index * 5, 150 - index * 7);
this.frame = function(){
this.time += 3;
this.x = 100 + 100 * Math.sin(this.time / 180 * 3.1415);
}
this.render = function(){
console.log(
'%c■%c' + this.index,