Last active
April 18, 2016 11:51
-
-
Save fernandojunior/6b909bf8240065aa8e1e520ae4836a79 to your computer and use it in GitHub Desktop.
Hello World
This file contains hidden or 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
| license: MIT |
This file contains hidden or 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
| <!DOCTYPE> | |
| <html> | |
| <head> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> | |
| </head> | |
| <body> | |
| <main> | |
| <div class="container"> | |
| <div id="hello_world"></div> | |
| </div> | |
| </main> | |
| <hr/> | |
| <header> | |
| <div class="container"> | |
| <h1>Hello World</h1> | |
| </div> | |
| </header> | |
| <hr/> | |
| <footer class="footer"> | |
| <div class="container"></div> | |
| </footer> | |
| <script src="https://d3js.org/d3.v3.min.js"></script> | |
| <script src="script.js"></script> | |
| </body> | |
| </html> |
This file contains hidden or 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
| var randomInt = function(low, high) { | |
| return Math.floor(Math.random() * (high - low + 1) + low); | |
| } | |
| var color = function(hue) { | |
| return "hsl(" + hue + ", 100%, 50%)" | |
| } | |
| var helloWorld = function(msg) { | |
| var random = randomInt(1, 360); | |
| d3.select("#hello_world") | |
| .style({color: color(random), "font-size": random}) | |
| .html(msg); | |
| d3.select("footer .container") | |
| .html(function () { | |
| return "Random: " + random; | |
| }); | |
| } | |
| var loop = function(args) { | |
| var duration = 1000/2; | |
| var repeat = function() { | |
| helloWorld.call(null, args); | |
| setTimeout(repeat, duration); | |
| }; | |
| repeat(); | |
| } | |
| var msg = "Rebeca ♥"; | |
| // helloWorld(msg) | |
| loop(msg); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment