Permalink
Browse files

Update trianglify

  • Loading branch information...
1 parent d708730 commit 74df5d552d4bdfd77422e3096ff20167d670fe71 @mistic100 committed Feb 16, 2017
Showing with 13 additions and 13 deletions.
  1. +2 −3 _layouts/default.html
  2. +11 −10 assets/js/script.js
@@ -190,9 +190,8 @@ <h1 class="home-title">{{site.name}}</h1>
<!-- Async scripts
=========================================== -->
{% if site.header.trianglify %}
- <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/trianglify/0.1.2/trianglify.min.js"></script>
- <script>trianglify('{{site.header.color1}}', '{{site.header.color2}}');</script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/trianglify/1.0.1/trianglify.min.js"></script>
+ <script>trianglify('{{site.header.color1}}', '{{site.header.color2}}', '{{site.name}}');</script>
{% endif %}
{% if site.twitter.enabled or site.twitter.account %}
View
@@ -45,14 +45,15 @@ $(function() {
});
});
-function trianglify(color1, color2) {
- var header = $('#content'),
- t = new Trianglify({
- cellsize: 90,
- noiseIntensity: 0,
- x_gradient: [color1, color2]
- }),
- pattern = t.generate(window.screen.width | header.outerWidth(), header.outerHeight() * 1.2);
-
- header.css('background-image', pattern.dataUrl);
+function trianglify(color1, color2, seed) {
+ var header = $('#content');
+ var pattern = Trianglify({
+ width: window.screen.width | header.outerWidth(),
+ height: header.outerHeight(),
+ cell_size: 90,
+ seed: seed,
+ x_colors: [color1, color2]
+ });
+
+ header.css('background-image', 'url(' + pattern.png() + ')');
}

0 comments on commit 74df5d5

Please sign in to comment.