Created
June 6, 2014 22:12
-
-
Save Klowner/04606b35c9870bb9311e to your computer and use it in GitHub Desktop.
The first commented line is your dabblet’s title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
body { | |
background: #f06; | |
background: linear-gradient(45deg, #f0f, #f02); | |
min-height: 100%; | |
overflow: hidden; | |
height: 100%; | |
} | |
h1 { | |
font-family: sans-serif; | |
color: #fff; | |
} | |
.dynamic { | |
position: absolute; | |
display: block; | |
} | |
.main { | |
text-align:center; | |
text-shadow: 0px 0px 200px #fff; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- content to be placed inside <body>…</body> --> | |
<link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> | |
<div class="main"> | |
<i class="fa fa-magic" style="font-size:20em"></i> | |
<h1>sumisusan.com</h1> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); | |
var count = 20; | |
var sprites = []; | |
var Sprite = function (x,y, elem) { | |
this.x = x; | |
this.y = y; | |
this.xv = Math.random(); | |
this.yv = Math.random(); | |
this.sv = Math.random(); | |
this.s = 0; | |
this.elem = elem; | |
}; | |
var r = document.body.getClientRects()[0]; | |
Sprite.prototype = { | |
update: function (t) { | |
this.x = this.x + this.xv * t; | |
this.y = this.y + this.yv * t; | |
this.s = this.s + this.sv * t * 0.1; | |
this.elem.style.left = Math.floor(this.x) + 'px'; | |
this.elem.style.top = Math.floor(this.y) + 'px'; | |
this.elem.style.fontSize = this.s + 'px'; | |
if (this.x > r.width) { | |
this.s = this.x = 0; | |
} | |
if (this.y > r.height) { | |
this.s = this.y = 0; | |
} | |
} | |
}; | |
for (var i=0; i<count; i++) { | |
var e = document.createElement('i'); | |
e.className = 'fa fa-magic dynamic'; | |
e.id = "magic" + i; | |
document.getElementsByTagName('body')[0].appendChild(e); | |
sprites[i] = new Sprite(0, 0, e); | |
} | |
function update() { | |
for (var i =0; i < sprites.length; i++) { | |
sprites[i].update(10); | |
} | |
} | |
window.setInterval(update, 50); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment