mirror of
https://github.com/wahyd4/hexo-phase-junv.git
synced 2026-08-09 04:55:53 +10:00
done
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
menu:
|
||||
Home: /
|
||||
Archives: /archives
|
||||
|
||||
addthis:
|
||||
enable: true
|
||||
pubid:
|
||||
facebook: true
|
||||
twitter: true
|
||||
google: true
|
||||
pinterest: true
|
||||
|
||||
facebook:
|
||||
google_plus:
|
||||
twitter:
|
||||
github:
|
||||
|
||||
fancybox: true
|
||||
google_analytics:
|
||||
rss:
|
||||
@@ -0,0 +1,25 @@
|
||||
<% if (config.disqus_shortname){ %>
|
||||
<script type="text/javascript">
|
||||
var disqus_shortname = '<%= config.disqus_shortname %>';
|
||||
|
||||
(function(){
|
||||
var dsq = document.createElement('script');
|
||||
dsq.type = 'text/javascript';
|
||||
dsq.async = true;
|
||||
dsq.src = 'http://' + disqus_shortname + '.disqus.com/<% if (page.comments){ %>embed.js<% } else { %>count.js<% } %>';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
}());
|
||||
</script>
|
||||
<% } %>
|
||||
|
||||
<% if (theme.fancybox){ %>
|
||||
<link rel="stylesheet" href="<%- config.root %>fancybox/jquery.fancybox.css" media="screen" type="text/css">
|
||||
<script src="<%- config.root %>fancybox/jquery.fancybox.pack.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function($){
|
||||
$('.fancybox').fancybox();
|
||||
})(jQuery);
|
||||
</script>
|
||||
<% } %>
|
||||
|
||||
<%- partial('phasebeam') %>
|
||||
@@ -0,0 +1,48 @@
|
||||
<%
|
||||
var title = '';
|
||||
if (page.category) title += 'Category: ' + page.category;
|
||||
if (page.tag) title += 'Tag: ' + page.tag;
|
||||
if (page.archive){
|
||||
if (page.year) title += 'Archives: ' + page.year + (page.month ? '/' + page.month : '');
|
||||
else title += 'Archives';
|
||||
}
|
||||
%>
|
||||
|
||||
<header id="archive-header">
|
||||
<h1 class="alignleft"><%= title %></h1>
|
||||
<div class="search alignright">
|
||||
<form action="http://google.com/search" method="get" accept-charset="utf-8">
|
||||
<input type="text" name="q" results="0" placeholder="Search">
|
||||
<input type="hidden" name="q" value="site:<%- config.url.replace(/^https?:\/\//, '') %>">
|
||||
</form>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<% if (pagination == 2){ %>
|
||||
<% page.posts.each(function(item){ %>
|
||||
<%- partial('article', {item: item, index: true}) %>
|
||||
<% }); %>
|
||||
|
||||
<%- partial('pagination') %>
|
||||
<% } else { %>
|
||||
<% var this_year; %>
|
||||
<% page.each(function(item){ %>
|
||||
<% var year = item.date.year(); %>
|
||||
<% if (this_year != year || !this_year){ %>
|
||||
<% this_year = year; %>
|
||||
</section><section class="archives"><div class="year"><%= year %></div>
|
||||
<% } %>
|
||||
<article class="archive">
|
||||
<h1 class="title"><a href="<%- config.root %><%- item.permalink %>"><%= item.title %></a></h1>
|
||||
<footer>
|
||||
<time datetime="<%= item.date.toDate().toISOString() %>"><%= item.date.format('MMM D') %></time>
|
||||
<% if (item.categories){ %>
|
||||
<div class="cats"><%- partial('post/taxonomy', {taxonomy: item.categories, separator: ', '}) %></div>
|
||||
<% } %>
|
||||
<% if (item.tags){ %>
|
||||
<div class="tags"><%- partial('post/taxonomy', {taxonomy: item.tags, separator: ', '}) %></div>
|
||||
<% } %>
|
||||
</footer>
|
||||
</article>
|
||||
<% }); %>
|
||||
<% } %>
|
||||
@@ -0,0 +1,23 @@
|
||||
<article class="<%= item.layout %>">
|
||||
<header>
|
||||
<%- partial('post/title') %>
|
||||
<% if (item.layout == 'post'){ %><%- partial('post/date') %><% } %>
|
||||
</header>
|
||||
<div class="entry-content">
|
||||
<% if (item.excerpt && index){ %>
|
||||
<%- item.excerpt %>
|
||||
<% } else { %>
|
||||
<%- item.content %>
|
||||
<% } %>
|
||||
<% if (item.layout == 'post'){ %>
|
||||
<footer class="meta">
|
||||
<%- partial('post/category') %>
|
||||
<%- partial('post/tag') %>
|
||||
<% if (config.disqus_shortname && item.comment){ %>
|
||||
<a href="<%- item.permalink %>#disqus_thread" class="comment">Comments</a>
|
||||
<% } %>
|
||||
</footer>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- partial('comment') %>
|
||||
</article>
|
||||
@@ -0,0 +1,7 @@
|
||||
<% if (config.disqus_shortname && page.comments){ %>
|
||||
<section id="comment">
|
||||
<div id="disqus_thread" aria-live="polite">
|
||||
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
</div>
|
||||
</section>
|
||||
<% } %>
|
||||
@@ -0,0 +1,23 @@
|
||||
<div class="social alignright">
|
||||
<% if (theme.facebook){ %>
|
||||
<a class="facebook" href="http://www.facebook.com/<%= theme.facebook %>" title="Facebook">Facebook</a>
|
||||
<% } %>
|
||||
<% if (theme.google_plus){ %>
|
||||
<a class="google" href="https://plus.google.com/<%= theme.google_plus %>" title="Google+">Google+</a>
|
||||
<% } %>
|
||||
<% if (theme.twitter){ %>
|
||||
<a class="twitter" href="http://twitter.com/<%= theme.twitter %>" title="Twitter">Twitter</a>
|
||||
<% } %>
|
||||
<% if (theme.github){ %>
|
||||
<a class="github" href="https://github.com/<%= theme.github %>" title="GitHub">GitHub</a>
|
||||
<% } %>
|
||||
<a class="rss" href="<% if (theme.rss){ %><%- theme.rss %><% } else { %><%- config.root %>atom.xml<% } %>" title="RSS">RSS</a>
|
||||
</div>
|
||||
<p>
|
||||
<% if (config.author){ %>
|
||||
© <%= new Date().getFullYear() %> <%= config.author %>
|
||||
<% } else { %>
|
||||
© <%= new Date().getFullYear() %> <%= config.title %>
|
||||
<% } %>
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<% if (theme.google_analytics){ %>
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', '<%= theme.google_analytics %>']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
<% } %>
|
||||
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<%
|
||||
var title = '';
|
||||
if (page.current && page.current != 1) title += 'Page ' + page.current;
|
||||
if (title) title += ' | ';
|
||||
if (page.title) title += page.title;
|
||||
if (page.category) title += 'Category: ' + page.category;
|
||||
if (page.tag) title += 'Tag: ' + page.tag;
|
||||
if (page.archive){
|
||||
title += 'Archives';
|
||||
if (page.year) title += ': ' + page.year + (page.month ? '/' + page.month : '');
|
||||
}
|
||||
if (title) title += ' | ' + config.title;
|
||||
else title += config.title;
|
||||
%>
|
||||
<title><%= title %></title>
|
||||
<% if (config.author){ %><meta name="author" content="<%= config.author %>"><% } %>
|
||||
|
||||
<% if (page.description){ %>
|
||||
<meta name="description" content="<%= page.description %>">
|
||||
<% } else if (config.description){ %>
|
||||
<meta name="description" content="<%= config.description %>">
|
||||
<% } else if (page.excerpt){ %>
|
||||
<meta name="description" content="<%= strip_html(page.excerpt).replace(/^\s*/, '').replace(/\s*$/, '') %>">
|
||||
<% } else if (page.content){ %>
|
||||
<meta name="description" content="<%= strip_html(page.content).replace(/^\s*/, '').replace(/\s*$/, '').substring(0, 150) %>">
|
||||
<% } %>
|
||||
<% if (page.keywords){ %><meta name="keywords" content="<%= page.keywords %>"><% } %>
|
||||
|
||||
<link rel="alternate" href="<% if (theme.rss){ %><%- theme.rss %><% } else { %><%- config.root %>atom.xml<% } %>" title="<%= config.title %>" type="application/atom+xml">
|
||||
<link rel="stylesheet" href="<%- config.root %>css/style.css" media="screen" type="text/css">
|
||||
<!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
|
||||
<%- partial('google_analytics') %>
|
||||
</head>
|
||||
@@ -0,0 +1,7 @@
|
||||
<nav>
|
||||
<ul>
|
||||
<% for (var i in theme.menu){ %>
|
||||
<li><a href="<%- theme.menu[i] %>"><%= i %></a></li>
|
||||
<% } %>
|
||||
</ul>
|
||||
</nav>
|
||||
@@ -0,0 +1,9 @@
|
||||
<nav id="pagenavi">
|
||||
<% if (page.prev){ %>
|
||||
<a href="<%- config.root %><%- page.prev_link %>" class="alignleft prev">Prev</a>
|
||||
<% } %>
|
||||
<% if (page.next){ %>
|
||||
<a href="<%- config.root %><%- page.next_link %>" class="alignright next">Next</a>
|
||||
<% } %>
|
||||
<div class="clearfix"></div>
|
||||
</nav>
|
||||
@@ -0,0 +1,6 @@
|
||||
<div id="phasebeam">
|
||||
<canvas></canvas>
|
||||
<canvas></canvas>
|
||||
<canvas></canvas>
|
||||
</div>
|
||||
<script src="<%- config.root %>js/phasebeam.js"></script>
|
||||
@@ -0,0 +1,3 @@
|
||||
<% if (item.categories){ %>
|
||||
<div class="categories"><%- partial('taxonomy', {taxonomy: item.categories, separator: ''}) %></div>
|
||||
<% } %>
|
||||
@@ -0,0 +1,3 @@
|
||||
<time datetime="<%= item.date.toDate().toISOString() %>">
|
||||
<span class="day"><%= item.date.format('D') %></span><span class="month"><%= item.date.format('MMM') %></span>
|
||||
</time>
|
||||
@@ -0,0 +1,18 @@
|
||||
<% if (theme.addthis.enable){ %>
|
||||
<div class="sharing addthis_toolbox addthis_default_style">
|
||||
<% if (theme.addthis.facebook){ %>
|
||||
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
|
||||
<% } %>
|
||||
<% if (theme.addthis.twitter){ %>
|
||||
<a class="addthis_button_tweet"></a>
|
||||
<% } %>
|
||||
<% if (theme.addthis.google){ %>
|
||||
<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
|
||||
<% } %>
|
||||
<% if (theme.addthis.pinterest){ %>
|
||||
<a class="addthis_button_pinterest_pinit" pi:pinit:layout="horizontal"></a>
|
||||
<% } %>
|
||||
<a class="addthis_counter addthis_pill_style"></a>
|
||||
</div>
|
||||
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js<% if (theme.addthis.pubid){ %>#pubid=<%= theme.addthis.pubid %><% } %>"></script>
|
||||
<% } %>
|
||||
@@ -0,0 +1,3 @@
|
||||
<% if (item.tags){ %>
|
||||
<div class="tags"><%- partial('taxonomy', {taxonomy: item.tags, separator: ''}) %></div>
|
||||
<% } %>
|
||||
@@ -0,0 +1,7 @@
|
||||
<%
|
||||
var arr = [];
|
||||
taxonomy.forEach(function(item){
|
||||
arr.push('<a href="' + config.root + item.path + '">' + item.name + '</a>');
|
||||
});
|
||||
%>
|
||||
<%- arr.join(separator) %>
|
||||
@@ -0,0 +1,13 @@
|
||||
<% if (item.link){ %>
|
||||
<% if (item.title){ %>
|
||||
<h1 class="title"><a href="<%- item.link %>" target="_blank"><%= item.title %></a></h1>
|
||||
<% } else { %>
|
||||
<h1 class="title"><a href="<%- item.link %>" target="_blank"><%= item.link %></a></h1>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<% if (index){ %>
|
||||
<h1 class="title"><a href="<%- config.root %><%- item.path %>"><%= item.title %></a></h1>
|
||||
<% } else { %>
|
||||
<h1 class="title"><%= item.title %></h1>
|
||||
<% } %>
|
||||
<% } %>
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
<%- partial('_partial/archive', {pagination: config.archive}) %>
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
<%- partial('_partial/archive', {pagination: config.category}) %>
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
<% page.posts.each(function(item){ %>
|
||||
<%- partial('_partial/article', {item: item, index: true}) %>
|
||||
<% }); %>
|
||||
|
||||
<%- partial('_partial/pagination') %>
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
<%- partial('_partial/article', {item: page, index: false}) %>
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
<%- partial('_partial/article', {item: page, index: false}) %>
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
<%- partial('_partial/archive', {pagination: config.tag}) %>
|
||||
@@ -4,32 +4,24 @@
|
||||
|
||||
body
|
||||
background color-background
|
||||
color color-font
|
||||
font-family font-default
|
||||
font-size 14px
|
||||
font 300 14px font-main
|
||||
text-shadow 0 0 1px transparent
|
||||
@media screen and (max-width: 1260px)
|
||||
margin 0 30px
|
||||
@media screen and (max-width: 600px)
|
||||
font-size 13px
|
||||
|
||||
h1, h2, h3, h4, h5, h6
|
||||
font-family font-title
|
||||
|
||||
h1
|
||||
font-size 1.8em
|
||||
font-size 2em
|
||||
|
||||
h2
|
||||
font-size 1.5em
|
||||
font-size 1.6em
|
||||
|
||||
h3
|
||||
font-size 1.3em
|
||||
|
||||
a
|
||||
color color-main01
|
||||
text-decoration none
|
||||
color color-link
|
||||
&:hover
|
||||
text-decoration underline
|
||||
|
||||
strong
|
||||
font-weight bold
|
||||
|
||||
.alignleft
|
||||
float left
|
||||
@@ -41,22 +33,7 @@ a
|
||||
clearfix()
|
||||
|
||||
.inner
|
||||
width page-width
|
||||
margin 0 auto
|
||||
@media screen and (max-width: 1260px)
|
||||
width 100%
|
||||
|
||||
#main-col
|
||||
width 900px
|
||||
@media screen and (max-width: 1260px)
|
||||
width 100%
|
||||
margin-right -300px
|
||||
@media screen and (max-width: 900px)
|
||||
margin-right 0
|
||||
float none
|
||||
|
||||
#wrapper
|
||||
@media screen and (max-width: 1260px)
|
||||
margin-right 300px
|
||||
@media screen and (max-width: 900px)
|
||||
margin-right 0
|
||||
position relative
|
||||
width 1000px
|
||||
z-index 0
|
||||
@@ -9,7 +9,7 @@ color-main03 = rgb(0, 150, 240)
|
||||
color-main04 = rgb(0, 26, 77)
|
||||
|
||||
// Font
|
||||
font-default = "Helvetica Neue", "Helvetica", Arial, sans-serif
|
||||
font-main = "Helvetica Neue", "Helvetica", Arial, sans-serif
|
||||
font-serif = "Georgia", serif
|
||||
font-mono = Monaco, Menlo, Consolas, Courier New, monospace
|
||||
font-title = "Pontano Sans", Helvetica Neue, Helvetica, Arial, sans-serif
|
||||
|
||||
@@ -91,4 +91,9 @@
|
||||
&:before
|
||||
content "\f02c"
|
||||
font-family font-icon
|
||||
padding-right 10px
|
||||
padding-right 10px
|
||||
|
||||
.archive
|
||||
box-shadow none
|
||||
border none
|
||||
margin-bottom 0
|
||||
@@ -23,7 +23,7 @@ article
|
||||
color color-meta
|
||||
position absolute
|
||||
top 15px
|
||||
left -meta-width - 20px
|
||||
left 0 - meta-width - 20px
|
||||
z-index 1
|
||||
user-select none
|
||||
.day
|
||||
@@ -206,7 +206,7 @@ article
|
||||
font-size 0.9em
|
||||
position absolute
|
||||
top 30px
|
||||
left -meta-width - 20px
|
||||
left 0 - meta-width - 20px
|
||||
width meta-width
|
||||
z-index 1
|
||||
a
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,235 @@
|
||||
(function($){
|
||||
var canvas = $('#phasebeam').children('canvas'),
|
||||
background = canvas[0],
|
||||
foreground1 = canvas[1],
|
||||
foreground2 = canvas[2],
|
||||
config = {
|
||||
circle: {
|
||||
amount: 18,
|
||||
layer: 3,
|
||||
color: [157, 97, 207],
|
||||
alpha: 0.3
|
||||
},
|
||||
line: {
|
||||
amount: 12,
|
||||
layer: 3,
|
||||
color: [255, 255, 255],
|
||||
alpha: 0.3
|
||||
},
|
||||
speed: 0.5,
|
||||
angle: 20
|
||||
};
|
||||
|
||||
if (background.getContext){
|
||||
var bctx = background.getContext('2d'),
|
||||
fctx1 = foreground1.getContext('2d'),
|
||||
fctx2 = foreground2.getContext('2d'),
|
||||
M = window.Math, // Cached Math
|
||||
degree = config.angle/360*M.PI*2,
|
||||
circles = [],
|
||||
lines = [],
|
||||
wWidth, wHeight, timer;
|
||||
|
||||
requestAnimationFrame = window.requestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.msRequestAnimationFrame ||
|
||||
window.oRequestAnimationFrame ||
|
||||
function(callback, element) { setTimeout(callback, 1000 / 60); };
|
||||
|
||||
cancelAnimationFrame = window.cancelAnimationFrame ||
|
||||
window.mozCancelAnimationFrame ||
|
||||
window.webkitCancelAnimationFrame ||
|
||||
window.msCancelAnimationFrame ||
|
||||
window.oCancelAnimationFrame ||
|
||||
clearTimeout;
|
||||
|
||||
var setCanvasHeight = function(){
|
||||
wWidth = $(window).width();
|
||||
wHeight = $(window).height(),
|
||||
|
||||
canvas.each(function(){
|
||||
this.width = wWidth;
|
||||
this.height = wHeight;
|
||||
});
|
||||
};
|
||||
|
||||
var drawCircle = function(x, y, radius, color, alpha){
|
||||
var gradient = fctx1.createRadialGradient(x, y, radius, x, y, 0);
|
||||
gradient.addColorStop(0, 'rgba('+color[0]+','+color[1]+','+color[2]+','+alpha+')');
|
||||
gradient.addColorStop(1, 'rgba('+color[0]+','+color[1]+','+color[2]+','+(alpha-0.1)+')');
|
||||
|
||||
fctx1.beginPath();
|
||||
fctx1.arc(x, y, radius, 0, M.PI*2, true);
|
||||
fctx1.fillStyle = gradient;
|
||||
fctx1.fill();
|
||||
};
|
||||
|
||||
var drawLine = function(x, y, width, color, alpha){
|
||||
var endX = x+M.sin(degree)*width,
|
||||
endY = y-M.cos(degree)*width,
|
||||
gradient = fctx2.createLinearGradient(x, y, endX, endY);
|
||||
gradient.addColorStop(0, 'rgba('+color[0]+','+color[1]+','+color[2]+','+alpha+')');
|
||||
gradient.addColorStop(1, 'rgba('+color[0]+','+color[1]+','+color[2]+','+(alpha-0.1)+')');
|
||||
|
||||
fctx2.beginPath();
|
||||
fctx2.moveTo(x, y);
|
||||
fctx2.lineTo(endX, endY);
|
||||
fctx2.lineWidth = 3;
|
||||
fctx2.lineCap = 'round';
|
||||
fctx2.strokeStyle = gradient;
|
||||
fctx2.stroke();
|
||||
};
|
||||
|
||||
var drawBack = function(){
|
||||
bctx.clearRect(0, 0, wWidth, wHeight);
|
||||
|
||||
var gradient = [];
|
||||
|
||||
gradient[0] = bctx.createRadialGradient(wWidth*0.3, wHeight*0.1, 0, wWidth*0.3, wHeight*0.1, wWidth*0.9);
|
||||
gradient[0].addColorStop(0, 'rgb(0, 26, 77)');
|
||||
gradient[0].addColorStop(1, 'transparent');
|
||||
|
||||
bctx.translate(wWidth, 0);
|
||||
bctx.scale(-1,1);
|
||||
bctx.beginPath();
|
||||
bctx.fillStyle = gradient[0];
|
||||
bctx.fillRect(0, 0, wWidth, wHeight);
|
||||
|
||||
gradient[1] = bctx.createRadialGradient(wWidth*0.1, wHeight*0.1, 0, wWidth*0.3, wHeight*0.1, wWidth);
|
||||
gradient[1].addColorStop(0, 'rgb(0, 150, 240)');
|
||||
gradient[1].addColorStop(0.8, 'transparent');
|
||||
|
||||
bctx.translate(wWidth, 0);
|
||||
bctx.scale(-1,1);
|
||||
bctx.beginPath();
|
||||
bctx.fillStyle = gradient[1];
|
||||
bctx.fillRect(0, 0, wWidth, wHeight);
|
||||
|
||||
gradient[2] = bctx.createRadialGradient(wWidth*0.1, wHeight*0.5, 0, wWidth*0.1, wHeight*0.5, wWidth*0.5);
|
||||
gradient[2].addColorStop(0, 'rgb(40, 20, 105)');
|
||||
gradient[2].addColorStop(1, 'transparent');
|
||||
|
||||
bctx.beginPath();
|
||||
bctx.fillStyle = gradient[2];
|
||||
bctx.fillRect(0, 0, wWidth, wHeight);
|
||||
};
|
||||
|
||||
var animate = function(){
|
||||
var sin = M.sin(degree),
|
||||
cos = M.cos(degree);
|
||||
|
||||
if (config.circle.amount > 0 && config.circle.layer > 0){
|
||||
fctx1.clearRect(0, 0, wWidth, wHeight);
|
||||
for (var i=0, len = circles.length; i<len; i++){
|
||||
var item = circles[i],
|
||||
x = item.x,
|
||||
y = item.y,
|
||||
radius = item.radius,
|
||||
speed = item.speed;
|
||||
|
||||
if (x > wWidth + radius){
|
||||
x = -radius;
|
||||
} else if (x < -radius){
|
||||
x = wWidth + radius
|
||||
} else {
|
||||
x += sin*speed;
|
||||
}
|
||||
|
||||
if (y > wHeight + radius){
|
||||
y = -radius;
|
||||
} else if (y < -radius){
|
||||
y = wHeight + radius;
|
||||
} else {
|
||||
y -= cos*speed;
|
||||
}
|
||||
|
||||
item.x = x;
|
||||
item.y = y;
|
||||
drawCircle(x, y, radius, item.color, item.alpha);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.line.amount > 0 && config.line.layer > 0){
|
||||
fctx2.clearRect(0, 0, wWidth, wHeight);
|
||||
for (var j=0, len = lines.length; j<len; j++){
|
||||
var item = lines[j],
|
||||
x = item.x,
|
||||
y = item.y,
|
||||
width = item.width,
|
||||
speed = item.speed;
|
||||
|
||||
if (x > wWidth + width * sin){
|
||||
x = -width * sin;
|
||||
} else if (x < -width * sin){
|
||||
x = wWidth + width * sin;
|
||||
} else {
|
||||
x += sin*speed;
|
||||
}
|
||||
|
||||
if (y > wHeight + width * cos){
|
||||
y = -width * cos;
|
||||
} else if (y < -width * cos){
|
||||
y = wHeight + width * cos;
|
||||
} else {
|
||||
y -= cos*speed;
|
||||
}
|
||||
|
||||
item.x = x;
|
||||
item.y = y;
|
||||
drawLine(x, y, width, item.color, item.alpha);
|
||||
}
|
||||
}
|
||||
|
||||
timer = requestAnimationFrame(animate);
|
||||
};
|
||||
|
||||
var createItem = function(){
|
||||
circles = [];
|
||||
lines = [];
|
||||
|
||||
if (config.circle.amount > 0 && config.circle.layer > 0){
|
||||
for (var i=0; i<config.circle.amount/config.circle.layer; i++){
|
||||
for (var j=0; j<config.circle.layer; j++){
|
||||
circles.push({
|
||||
x: M.random() * wWidth,
|
||||
y: M.random() * wHeight,
|
||||
radius: M.random()*(20+j*5)+(20+j*5),
|
||||
color: config.circle.color,
|
||||
alpha: M.random()*0.2+(config.circle.alpha-j*0.1),
|
||||
speed: config.speed*(1+j*0.5)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.line.amount > 0 && config.line.layer > 0){
|
||||
for (var m=0; m<config.line.amount/config.line.layer; m++){
|
||||
for (var n=0; n<config.line.layer; n++){
|
||||
lines.push({
|
||||
x: M.random() * wWidth,
|
||||
y: M.random() * wHeight,
|
||||
width: M.random()*(20+n*5)+(20+n*5),
|
||||
color: config.line.color,
|
||||
alpha: M.random()*0.2+(config.line.alpha-n*0.1),
|
||||
speed: config.speed*(1+n*0.5)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cancelAnimationFrame(timer);
|
||||
timer = requestAnimationFrame(animate);
|
||||
drawBack();
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
setCanvasHeight();
|
||||
createItem();
|
||||
});
|
||||
$(window).resize(function(){
|
||||
setCanvasHeight();
|
||||
createItem();
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user