Site updated: 2022-07-10 10:58:06
This commit is contained in:
8
lib/anime.min.js
vendored
Normal file
8
lib/anime.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
21
lib/canvas-nest/LICENSE
Normal file
21
lib/canvas-nest/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 «NexT»
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
448
lib/canvas-nest/README.html
Normal file
448
lib/canvas-nest/README.html
Normal file
@@ -0,0 +1,448 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
|
||||
<meta name="theme-color" content="#222">
|
||||
<meta name="generator" content="Hexo 6.2.0">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
|
||||
<link rel="mask-icon" href="/images/logo.svg" color="#222">
|
||||
|
||||
<link rel="stylesheet" href="/css/main.css">
|
||||
|
||||
|
||||
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
|
||||
<link rel="stylesheet" href="/lib/pace/pace-theme-minimal.min.css">
|
||||
<script src="/lib/pace/pace.min.js"></script>
|
||||
|
||||
<script id="hexo-configurations">
|
||||
var NexT = window.NexT || {};
|
||||
var CONFIG = {"hostname":"example.com","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
|
||||
</script>
|
||||
|
||||
|
||||
<meta name="description" content="Theme NexT Canvas Nest canvas-nest.js for NexT. InstallStep 1 &rarr; Go to Hexo dirChange dir to Hexo directory. There must be scaffolds, source, themes and other directories: 123$ cd hexo$ lsscaf">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="流量不足ow的个人博客">
|
||||
<meta property="og:url" content="http://example.com/lib/canvas-nest/README.html">
|
||||
<meta property="og:site_name" content="流量不足ow的个人博客">
|
||||
<meta property="og:description" content="Theme NexT Canvas Nest canvas-nest.js for NexT. InstallStep 1 &rarr; Go to Hexo dirChange dir to Hexo directory. There must be scaffolds, source, themes and other directories: 123$ cd hexo$ lsscaf">
|
||||
<meta property="og:locale" content="zh_CN">
|
||||
<meta property="og:image" content="https://img.shields.io/badge/NexT-v7.3.0+-blue?style=flat-square">
|
||||
<meta property="article:published_time" content="2022-06-19T02:28:46.096Z">
|
||||
<meta property="article:modified_time" content="2022-06-19T02:28:46.096Z">
|
||||
<meta property="article:author" content="llbzow">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://img.shields.io/badge/NexT-v7.3.0+-blue?style=flat-square">
|
||||
|
||||
<link rel="canonical" href="http://example.com/lib/canvas-nest/README">
|
||||
|
||||
|
||||
<script id="page-configurations">
|
||||
// https://hexo.io/docs/variables.html
|
||||
CONFIG.page = {
|
||||
sidebar: "",
|
||||
isHome : false,
|
||||
isPost : false,
|
||||
lang : 'zh-CN'
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
if ('') {
|
||||
if (prompt('请输入文章密码') !== '') {
|
||||
alert('密码错误!');
|
||||
if (history.length === 1) {
|
||||
location.replace("http://blog.llbzow.tk"); // 这里替换成你的首页
|
||||
} else {
|
||||
history.back();
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<title> | 流量不足ow的个人博客
|
||||
</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<noscript>
|
||||
<style>
|
||||
.use-motion .brand,
|
||||
.use-motion .menu-item,
|
||||
.sidebar-inner,
|
||||
.use-motion .post-block,
|
||||
.use-motion .pagination,
|
||||
.use-motion .comments,
|
||||
.use-motion .post-header,
|
||||
.use-motion .post-body,
|
||||
.use-motion .collection-header { opacity: initial; }
|
||||
|
||||
.use-motion .site-title,
|
||||
.use-motion .site-subtitle {
|
||||
opacity: initial;
|
||||
top: initial;
|
||||
}
|
||||
|
||||
.use-motion .logo-line-before i { left: initial; }
|
||||
.use-motion .logo-line-after i { right: initial; }
|
||||
</style>
|
||||
</noscript>
|
||||
|
||||
</head>
|
||||
|
||||
<body itemscope itemtype="http://schema.org/WebPage">
|
||||
<div class="container use-motion">
|
||||
<div class="headband"></div>
|
||||
|
||||
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
|
||||
<div class="header-inner"><div class="site-brand-container">
|
||||
<div class="site-nav-toggle">
|
||||
<div class="toggle" aria-label="切换导航栏">
|
||||
<span class="toggle-line toggle-line-first"></span>
|
||||
<span class="toggle-line toggle-line-middle"></span>
|
||||
<span class="toggle-line toggle-line-last"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="site-meta">
|
||||
|
||||
<a href="/" class="brand" rel="start">
|
||||
<span class="logo-line-before"><i></i></span>
|
||||
<h1 class="site-title">流量不足ow的个人博客</h1>
|
||||
<span class="logo-line-after"><i></i></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="site-nav-right">
|
||||
<div class="toggle popup-trigger">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="site-nav">
|
||||
<ul id="menu" class="main-menu menu">
|
||||
<li class="menu-item menu-item-home">
|
||||
|
||||
<a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>
|
||||
|
||||
</li>
|
||||
<li class="menu-item menu-item-about">
|
||||
|
||||
<a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>
|
||||
|
||||
</li>
|
||||
<li class="menu-item menu-item-tags">
|
||||
|
||||
<a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>
|
||||
|
||||
</li>
|
||||
<li class="menu-item menu-item-categories">
|
||||
|
||||
<a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>
|
||||
|
||||
</li>
|
||||
<li class="menu-item menu-item-archives">
|
||||
|
||||
<a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
<div class="back-to-top">
|
||||
<i class="fa fa-arrow-up"></i>
|
||||
<span>0%</span>
|
||||
</div>
|
||||
|
||||
|
||||
<main class="main">
|
||||
<div class="main-inner">
|
||||
<div class="content-wrap">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="content page posts-expand">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="post-block" lang="zh-CN">
|
||||
<header class="post-header">
|
||||
|
||||
<h1 class="post-title" itemprop="name headline">
|
||||
</h1>
|
||||
|
||||
<div class="post-meta">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
|
||||
<li><a href="/lib/">LIB</a></li>
|
||||
<li><a href="/lib/canvas-nest/">CANVAS-NEST</a></li>
|
||||
<li>README</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="post-body">
|
||||
<h1 id="Theme-NexT-Canvas-Nest"><a href="#Theme-NexT-Canvas-Nest" class="headerlink" title="Theme NexT Canvas Nest"></a>Theme NexT Canvas Nest</h1><p><img src="https://img.shields.io/badge/NexT-v7.3.0+-blue?style=flat-square" alt="Theme Version"></p>
|
||||
<p><a target="_blank" rel="noopener" href="https://github.com/hustcc/canvas-nest.js">canvas-nest.js</a> for <a target="_blank" rel="noopener" href="https://github.com/theme-next">NexT</a>.</p>
|
||||
<h2 id="Install"><a href="#Install" class="headerlink" title="Install"></a>Install</h2><h3 id="Step-1-amp-rarr-Go-to-Hexo-dir"><a href="#Step-1-amp-rarr-Go-to-Hexo-dir" class="headerlink" title="Step 1 &rarr; Go to Hexo dir"></a>Step 1 &rarr; Go to Hexo dir</h3><p>Change dir to <strong>Hexo</strong> directory. There must be <code>scaffolds</code>, <code>source</code>, <code>themes</code> and other directories:</p>
|
||||
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ <span class="built_in">cd</span> hexo</span><br><span class="line">$ <span class="built_in">ls</span></span><br><span class="line">scaffolds <span class="built_in">source</span> themes _config.yml package.json</span><br></pre></td></tr></table></figure>
|
||||
|
||||
<h3 id="Step-2-amp-rarr-Create-footer-swig"><a href="#Step-2-amp-rarr-Create-footer-swig" class="headerlink" title="Step 2 &rarr; Create footer.swig"></a>Step 2 &rarr; Create <code>footer.swig</code></h3><p>Create a file named <code>footer.swig</code> in <code>hexo/source/_data</code> directory (create <code>_data</code> directory if it does not exist).</p>
|
||||
<p>Edit this file and add the following content:</p>
|
||||
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag"><<span class="name">script</span> <span class="attr">color</span>=<span class="string">"0,0,255"</span> <span class="attr">opacity</span>=<span class="string">"0.5"</span> <span class="attr">zIndex</span>=<span class="string">"-1"</span> <span class="attr">count</span>=<span class="string">"99"</span> <span class="attr">src</span>=<span class="string">"https://cdn.jsdelivr.net/npm/canvas-nest.js@1/dist/canvas-nest.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br></pre></td></tr></table></figure>
|
||||
|
||||
<p>You can customize these options.</p>
|
||||
<h3 id="Step-3-amp-rarr-Set-it-up"><a href="#Step-3-amp-rarr-Set-it-up" class="headerlink" title="Step 3 &rarr; Set it up"></a>Step 3 &rarr; Set it up</h3><p>In the NexT <code>_config.yml</code>, uncomment <code>footer</code> under the <code>custom_file_path</code> section.</p>
|
||||
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Define custom file paths.</span></span><br><span class="line"><span class="comment"># Create your custom files in site directory `source/_data` and uncomment needed files below.</span></span><br><span class="line"><span class="attr">custom_file_path:</span></span><br><span class="line"> <span class="comment">#head: source/_data/head.swig</span></span><br><span class="line"> <span class="comment">#header: source/_data/header.swig</span></span><br><span class="line"> <span class="comment">#sidebar: source/_data/sidebar.swig</span></span><br><span class="line"> <span class="comment">#postMeta: source/_data/post-meta.swig</span></span><br><span class="line"> <span class="comment">#postBodyEnd: source/_data/post-body-end.swig</span></span><br><span class="line"> <span class="attr">footer:</span> <span class="string">source/_data/footer.swig</span></span><br><span class="line"> <span class="comment">#bodyEnd: source/_data/body-end.swig</span></span><br><span class="line"> <span class="comment">#variable: source/_data/variables.styl</span></span><br><span class="line"> <span class="comment">#mixin: source/_data/mixins.styl</span></span><br><span class="line"> <span class="comment">#style: source/_data/styles.styl</span></span><br></pre></td></tr></table></figure>
|
||||
<link rel="stylesheet" href="/css/spoiler.css" type="text/css"><script src="/js/spoiler.js" type="text/javascript" async></script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<ul class="breadcrumb">
|
||||
|
||||
<li><a href="/lib/">LIB</a></li>
|
||||
<li><a href="/lib/canvas-nest/">CANVAS-NEST</a></li>
|
||||
<li>README</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="comments" id="gitalk-container"></div>
|
||||
|
||||
<script>
|
||||
window.addEventListener('tabs:register', () => {
|
||||
let { activeClass } = CONFIG.comments;
|
||||
if (CONFIG.comments.storage) {
|
||||
activeClass = localStorage.getItem('comments_active') || activeClass;
|
||||
}
|
||||
if (activeClass) {
|
||||
let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
|
||||
if (activeTab) {
|
||||
activeTab.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (CONFIG.comments.storage) {
|
||||
window.addEventListener('tabs:click', event => {
|
||||
if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
|
||||
let commentClass = event.target.classList[1];
|
||||
localStorage.setItem('comments_active', commentClass);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="toggle sidebar-toggle">
|
||||
<span class="toggle-line toggle-line-first"></span>
|
||||
<span class="toggle-line toggle-line-middle"></span>
|
||||
<span class="toggle-line toggle-line-last"></span>
|
||||
</div>
|
||||
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-inner">
|
||||
|
||||
<ul class="sidebar-nav motion-element">
|
||||
<li class="sidebar-nav-toc">
|
||||
文章目录
|
||||
</li>
|
||||
<li class="sidebar-nav-overview">
|
||||
站点概览
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--noindex-->
|
||||
<div class="post-toc-wrap sidebar-panel">
|
||||
<div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#Theme-NexT-Canvas-Nest"><span class="nav-number">1.</span> <span class="nav-text">Theme NexT Canvas Nest</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Install"><span class="nav-number">1.1.</span> <span class="nav-text">Install</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Step-1-amp-rarr-Go-to-Hexo-dir"><span class="nav-number">1.1.1.</span> <span class="nav-text">Step 1 &rarr; Go to Hexo dir</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Step-2-amp-rarr-Create-footer-swig"><span class="nav-number">1.1.2.</span> <span class="nav-text">Step 2 &rarr; Create footer.swig</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Step-3-amp-rarr-Set-it-up"><span class="nav-number">1.1.3.</span> <span class="nav-text">Step 3 &rarr; Set it up</span></a></li></ol></li></ol></li></ol></div>
|
||||
</div>
|
||||
<!--/noindex-->
|
||||
|
||||
<div class="site-overview-wrap sidebar-panel">
|
||||
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||
<img class="site-author-image" itemprop="image" alt="llbzow"
|
||||
src="/images/avatar.png">
|
||||
<p class="site-author-name" itemprop="name">llbzow</p>
|
||||
<div class="site-description" itemprop="description"></div>
|
||||
</div>
|
||||
<div class="site-state-wrap motion-element">
|
||||
<nav class="site-state">
|
||||
<div class="site-state-item site-state-posts">
|
||||
<a href="/archives/">
|
||||
|
||||
<span class="site-state-item-count">1</span>
|
||||
<span class="site-state-item-name">日志</span>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
<div id="sidebar-dimmer"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="footer-inner">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="copyright">
|
||||
|
||||
© 2022-06 –
|
||||
<span itemprop="copyrightYear">2022</span>
|
||||
<span class="with-love">
|
||||
<i class="fa fa-heart"></i>
|
||||
</span>
|
||||
<span class="author" itemprop="copyrightHolder">llbzow</span>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
|
||||
</div>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<div class="busuanzi-count">
|
||||
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
|
||||
<span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-user"></i>
|
||||
</span>
|
||||
<span class="site-uv" title="总访客量">
|
||||
<span id="busuanzi_value_site_uv"></span>
|
||||
</span>
|
||||
</span>
|
||||
<span class="post-meta-divider">|</span>
|
||||
<span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-eye"></i>
|
||||
</span>
|
||||
<span class="site-pv" title="总访问量">
|
||||
<span id="busuanzi_value_site_pv"></span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script color='0,0,255' opacity='0.5' zIndex='-1' count='99' src="/lib/canvas-nest/canvas-nest.min.js"></script>
|
||||
<script size="300" alpha="0.6" zIndex="-1" src="/lib/canvas-ribbon/canvas-ribbon.js"></script>
|
||||
<script src="/lib/anime.min.js"></script>
|
||||
<script src="/lib/velocity/velocity.min.js"></script>
|
||||
<script src="/lib/velocity/velocity.ui.min.js"></script>
|
||||
|
||||
<script src="/js/utils.js"></script>
|
||||
|
||||
<script src="/js/motion.js"></script>
|
||||
|
||||
|
||||
<script src="/js/schemes/pisces.js"></script>
|
||||
|
||||
|
||||
<script src="/js/next-boot.js"></script>
|
||||
|
||||
|
||||
<script defer src="/lib/three/three.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css">
|
||||
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#gitalk-container'), () => {
|
||||
NexT.utils.getScript('//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js', () => {
|
||||
var gitalk = new Gitalk({
|
||||
clientID : '1e2867144d855824b913# GitHub Application Client ID',
|
||||
clientSecret: '3c474768436b020bd64b81c163e40c7ac7e3f1d6# GitHub Application Client Secret',
|
||||
repo : 'BlogComments# Repository name to store issues',
|
||||
owner : 'llbzow# GitHub repo owner',
|
||||
admin : ['llbzow# GitHub repo owner and collaborators, only these guys can initialize gitHub issues'],
|
||||
id : 'aeac19f9e6fb0f69935bfd9ac92f827e',
|
||||
language: '',
|
||||
distractionFreeMode: true
|
||||
});
|
||||
gitalk.render('gitalk-container');
|
||||
}, window.Gitalk);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/koharu.model.json"},"display":{"position":"left","width":250,"height":500},"mobile":{"show":true},"react":{"opacity":0.9},"log":false});</script></body>
|
||||
</html>
|
||||
11
lib/canvas-nest/canvas-nest-nomobile.min.js
vendored
Normal file
11
lib/canvas-nest/canvas-nest-nomobile.min.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
!function(){
|
||||
var userAgentInfo = navigator.userAgent;
|
||||
var Agents = ["iPad", "iPhone", "Android",
|
||||
"SymbianOS", "Windows Phone",
|
||||
"iPod", "webOS", "BlackBerry", "IEMobile"];
|
||||
for (var v = 0; v < Agents.length; v++) {
|
||||
if (userAgentInfo.indexOf(Agents[v]) > 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
function o(w,v,i){return w.getAttribute(v)||i}function j(i){return document.getElementsByTagName(i)}function l(){var i=j("script"),w=i.length,v=i[w-1];return{l:w,z:o(v,"zIndex",-1),o:o(v,"opacity",0.5),c:o(v,"color","0,0,0"),n:o(v,"count",99)}}function k(){r=u.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,n=u.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}function b(){e.clearRect(0,0,r,n);var w=[f].concat(t);var x,v,A,B,z,y;t.forEach(function(i){i.x+=i.xa,i.y+=i.ya,i.xa*=i.x>r||i.x<0?-1:1,i.ya*=i.y>n||i.y<0?-1:1,e.fillRect(i.x-0.5,i.y-0.5,1,1);for(v=0;v<w.length;v++){x=w[v];if(i!==x&&null!==x.x&&null!==x.y){B=i.x-x.x,z=i.y-x.y,y=B*B+z*z;y<x.max&&(x===f&&y>=x.max/2&&(i.x-=0.03*B,i.y-=0.03*z),A=(x.max-y)/x.max,e.beginPath(),e.lineWidth=A/2,e.strokeStyle="rgba("+s.c+","+(A+0.2)+")",e.moveTo(i.x,i.y),e.lineTo(x.x,x.y),e.stroke())}}w.splice(w.indexOf(i),1)}),m(b)}var u=document.createElement("canvas"),s=l(),c="c_n"+s.l,e=u.getContext("2d"),r,n,m=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(i){window.setTimeout(i,1000/45)},a=Math.random,f={x:null,y:null,max:20000};u.id=c;u.style.cssText="position:fixed;top:0;left:0;z-index:"+s.z+";opacity:"+s.o;j("body")[0].appendChild(u);k(),window.onresize=k;window.onmousemove=function(i){i=i||window.event,f.x=i.clientX,f.y=i.clientY},window.onmouseout=function(){f.x=null,f.y=null};for(var t=[],p=0;s.n>p;p++){var h=a()*r,g=a()*n,q=2*a()-1,d=2*a()-1;t.push({x:h,y:g,xa:q,ya:d,max:6000})}setTimeout(function(){b()},100)}();<link rel="stylesheet" href="/css/spoiler.css" type="text/css"><script src="/js/spoiler.js" type="text/javascript" async></script>
|
||||
1
lib/canvas-nest/canvas-nest.min.js
vendored
Normal file
1
lib/canvas-nest/canvas-nest.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(){function o(w,v,i){return w.getAttribute(v)||i}function j(i){return document.getElementsByTagName(i)}function l(){var i=j("script"),w=i.length,v=i[w-1];return{l:w,z:o(v,"zIndex",-1),o:o(v,"opacity",0.5),c:o(v,"color","0,0,0"),n:o(v,"count",99)}}function k(){r=u.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,n=u.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}function b(){e.clearRect(0,0,r,n);var w=[f].concat(t);var x,v,A,B,z,y;t.forEach(function(i){i.x+=i.xa,i.y+=i.ya,i.xa*=i.x>r||i.x<0?-1:1,i.ya*=i.y>n||i.y<0?-1:1,e.fillRect(i.x-0.5,i.y-0.5,1,1);for(v=0;v<w.length;v++){x=w[v];if(i!==x&&null!==x.x&&null!==x.y){B=i.x-x.x,z=i.y-x.y,y=B*B+z*z;y<x.max&&(x===f&&y>=x.max/2&&(i.x-=0.03*B,i.y-=0.03*z),A=(x.max-y)/x.max,e.beginPath(),e.lineWidth=A/2,e.strokeStyle="rgba("+s.c+","+(A+0.2)+")",e.moveTo(i.x,i.y),e.lineTo(x.x,x.y),e.stroke())}}w.splice(w.indexOf(i),1)}),m(b)}var u=document.createElement("canvas"),s=l(),c="c_n"+s.l,e=u.getContext("2d"),r,n,m=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(i){window.setTimeout(i,1000/45)},a=Math.random,f={x:null,y:null,max:20000};u.id=c;u.style.cssText="position:fixed;top:0;left:0;z-index:"+s.z+";opacity:"+s.o;j("body")[0].appendChild(u);k(),window.onresize=k;window.onmousemove=function(i){i=i||window.event,f.x=i.clientX,f.y=i.clientY},window.onmouseout=function(){f.x=null,f.y=null};for(var t=[],p=0;s.n>p;p++){var h=a()*r,g=a()*n,q=2*a()-1,d=2*a()-1;t.push({x:h,y:g,xa:q,ya:d,max:6000})}setTimeout(function(){b()},100)}();<link rel="stylesheet" href="/css/spoiler.css" type="text/css"><script src="/js/spoiler.js" type="text/javascript" async></script>
|
||||
5
lib/font-awesome/css/all.min.css
vendored
Normal file
5
lib/font-awesome/css/all.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
lib/font-awesome/webfonts/fa-brands-400.woff2
Normal file
BIN
lib/font-awesome/webfonts/fa-brands-400.woff2
Normal file
Binary file not shown.
BIN
lib/font-awesome/webfonts/fa-regular-400.woff2
Normal file
BIN
lib/font-awesome/webfonts/fa-regular-400.woff2
Normal file
Binary file not shown.
BIN
lib/font-awesome/webfonts/fa-solid-900.woff2
Normal file
BIN
lib/font-awesome/webfonts/fa-solid-900.woff2
Normal file
Binary file not shown.
21
lib/three/LICENSE
Normal file
21
lib/three/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 «NexT»
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
40
lib/three/README.html
Normal file
40
lib/three/README.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<h1 align="center"><a href="https://github.com/mrdoob/three.js">JavaScript 3D library</a> for <a href="https://github.com/theme-next">NexT</a></h1>
|
||||
|
||||
<h1 align="center">Installation</h1>
|
||||
|
||||
<h2>If you want to use the CDN instead of clone this repo, please jump to the Step 3.</h2>
|
||||
|
||||
<h2 align="center">Step 1 → Go to NexT dir</h2>
|
||||
|
||||
<p>Change dir to <strong>NexT</strong> directory. There must be <code>layout</code>, <code>source</code>, <code>languages</code> and other directories:</p>
|
||||
<pre><code class="sh">$ cd themes/next
|
||||
$ ls
|
||||
_config.yml crowdin.yml docs gulpfile.js languages layout LICENSE.md package.json README.md scripts source
|
||||
</code></pre>
|
||||
<h2 align="center">Step 2 → Get module</h2>
|
||||
|
||||
<p>Install module to <code>source/lib</code> directory:</p>
|
||||
<pre><code class="sh">$ git clone https://github.com/theme-next/theme-next-three source/lib/three
|
||||
</code></pre>
|
||||
<h2 align="center">Step 3 → Set it up</h2>
|
||||
|
||||
<p>Enable module in <strong>NexT</strong> <code>_config.yml</code> file:</p>
|
||||
<pre><code class="yml">three_waves: true
|
||||
OR
|
||||
canvas_lines: true
|
||||
OR
|
||||
canvas_sphere: true
|
||||
</code></pre>
|
||||
<p><strong>And, if you wants to use the CDN, then need to set:</strong></p>
|
||||
<pre><code class="yml">vendors:
|
||||
...
|
||||
three: //cdn.jsdelivr.net/gh/theme-next/theme-next-three@1/three.min.js
|
||||
three_waves: //cdn.jsdelivr.net/gh/theme-next/theme-next-three@latest/three-waves.min.js
|
||||
canvas_lines: //cdn.jsdelivr.net/gh/theme-next/theme-next-three@latest/canvas_lines.min.js
|
||||
canvas_sphere: //cdn.jsdelivr.net/gh/theme-next/theme-next-three@latest/canvas_sphere.min.js
|
||||
</code></pre>
|
||||
<h1 align="center">Update</h1>
|
||||
|
||||
<pre><code class="sh">$ cd themes/next/source/lib/three
|
||||
$ git pull
|
||||
</code></pre>
|
||||
2
lib/three/canvas_lines.min.js
vendored
Normal file
2
lib/three/canvas_lines.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
lib/three/canvas_sphere.min.js
vendored
Normal file
2
lib/three/canvas_sphere.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
lib/three/gulpfile.js
Normal file
22
lib/three/gulpfile.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const fs = require('fs')
|
||||
const del = require('del')
|
||||
const gulp = require('gulp')
|
||||
const concat = require('gulp-concat')
|
||||
const uglify = require('gulp-uglify')
|
||||
|
||||
gulp.task('clean', async () => {
|
||||
del(['*.min.js', '!three.min.js'])
|
||||
})
|
||||
|
||||
gulp.task('scripts', async () => {
|
||||
const sourceFiles = fs.readdirSync('src')
|
||||
sourceFiles.forEach(file => {
|
||||
const fileName = file.split('.')[0]
|
||||
return gulp.src([`src/${fileName}.js`, 'lib/*.js'])
|
||||
.pipe(concat(`${fileName}.min.js`))
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('./'))
|
||||
})
|
||||
})
|
||||
|
||||
gulp.task('default', gulp.series('clean', 'scripts'))
|
||||
1155
lib/three/lib/CanvasRenderer.js
Normal file
1155
lib/three/lib/CanvasRenderer.js
Normal file
File diff suppressed because it is too large
Load Diff
929
lib/three/lib/Projector.js
Normal file
929
lib/three/lib/Projector.js
Normal file
@@ -0,0 +1,929 @@
|
||||
/**
|
||||
* @author mrdoob / http://mrdoob.com/
|
||||
* @author supereggbert / http://www.paulbrunt.co.uk/
|
||||
* @author julianwa / https://github.com/julianwa
|
||||
*/
|
||||
|
||||
THREE.RenderableObject = function () {
|
||||
|
||||
this.id = 0;
|
||||
|
||||
this.object = null;
|
||||
this.z = 0;
|
||||
this.renderOrder = 0;
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
THREE.RenderableFace = function () {
|
||||
|
||||
this.id = 0;
|
||||
|
||||
this.v1 = new THREE.RenderableVertex();
|
||||
this.v2 = new THREE.RenderableVertex();
|
||||
this.v3 = new THREE.RenderableVertex();
|
||||
|
||||
this.normalModel = new THREE.Vector3();
|
||||
|
||||
this.vertexNormalsModel = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
|
||||
this.vertexNormalsLength = 0;
|
||||
|
||||
this.color = new THREE.Color();
|
||||
this.material = null;
|
||||
this.uvs = [ new THREE.Vector2(), new THREE.Vector2(), new THREE.Vector2() ];
|
||||
|
||||
this.z = 0;
|
||||
this.renderOrder = 0;
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
THREE.RenderableVertex = function () {
|
||||
|
||||
this.position = new THREE.Vector3();
|
||||
this.positionWorld = new THREE.Vector3();
|
||||
this.positionScreen = new THREE.Vector4();
|
||||
|
||||
this.visible = true;
|
||||
|
||||
};
|
||||
|
||||
THREE.RenderableVertex.prototype.copy = function ( vertex ) {
|
||||
|
||||
this.positionWorld.copy( vertex.positionWorld );
|
||||
this.positionScreen.copy( vertex.positionScreen );
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
THREE.RenderableLine = function () {
|
||||
|
||||
this.id = 0;
|
||||
|
||||
this.v1 = new THREE.RenderableVertex();
|
||||
this.v2 = new THREE.RenderableVertex();
|
||||
|
||||
this.vertexColors = [ new THREE.Color(), new THREE.Color() ];
|
||||
this.material = null;
|
||||
|
||||
this.z = 0;
|
||||
this.renderOrder = 0;
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
THREE.RenderableSprite = function () {
|
||||
|
||||
this.id = 0;
|
||||
|
||||
this.object = null;
|
||||
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.z = 0;
|
||||
|
||||
this.rotation = 0;
|
||||
this.scale = new THREE.Vector2();
|
||||
|
||||
this.material = null;
|
||||
this.renderOrder = 0;
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
THREE.Projector = function () {
|
||||
|
||||
var _object, _objectCount, _objectPool = [], _objectPoolLength = 0,
|
||||
_vertex, _vertexCount, _vertexPool = [], _vertexPoolLength = 0,
|
||||
_face, _faceCount, _facePool = [], _facePoolLength = 0,
|
||||
_line, _lineCount, _linePool = [], _linePoolLength = 0,
|
||||
_sprite, _spriteCount, _spritePool = [], _spritePoolLength = 0,
|
||||
|
||||
_renderData = { objects: [], lights: [], elements: [] },
|
||||
|
||||
_vector3 = new THREE.Vector3(),
|
||||
_vector4 = new THREE.Vector4(),
|
||||
|
||||
_clipBox = new THREE.Box3( new THREE.Vector3( - 1, - 1, - 1 ), new THREE.Vector3( 1, 1, 1 ) ),
|
||||
_boundingBox = new THREE.Box3(),
|
||||
_points3 = new Array( 3 ),
|
||||
_points4 = new Array( 4 ),
|
||||
|
||||
_viewMatrix = new THREE.Matrix4(),
|
||||
_viewProjectionMatrix = new THREE.Matrix4(),
|
||||
|
||||
_modelMatrix,
|
||||
_modelViewProjectionMatrix = new THREE.Matrix4(),
|
||||
|
||||
_normalMatrix = new THREE.Matrix3(),
|
||||
|
||||
_frustum = new THREE.Frustum(),
|
||||
|
||||
_clippedVertex1PositionScreen = new THREE.Vector4(),
|
||||
_clippedVertex2PositionScreen = new THREE.Vector4();
|
||||
|
||||
//
|
||||
|
||||
this.projectVector = function ( vector, camera ) {
|
||||
|
||||
console.warn( 'THREE.Projector: .projectVector() is now vector.project().' );
|
||||
vector.project( camera );
|
||||
|
||||
};
|
||||
|
||||
this.unprojectVector = function ( vector, camera ) {
|
||||
|
||||
console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
|
||||
vector.unproject( camera );
|
||||
|
||||
};
|
||||
|
||||
this.pickingRay = function ( vector, camera ) {
|
||||
|
||||
console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
var RenderList = function () {
|
||||
|
||||
var normals = [];
|
||||
var uvs = [];
|
||||
|
||||
var object = null;
|
||||
var material = null;
|
||||
|
||||
var normalMatrix = new THREE.Matrix3();
|
||||
|
||||
function setObject( value ) {
|
||||
|
||||
object = value;
|
||||
material = object.material;
|
||||
|
||||
normalMatrix.getNormalMatrix( object.matrixWorld );
|
||||
|
||||
normals.length = 0;
|
||||
uvs.length = 0;
|
||||
|
||||
}
|
||||
|
||||
function projectVertex( vertex ) {
|
||||
|
||||
var position = vertex.position;
|
||||
var positionWorld = vertex.positionWorld;
|
||||
var positionScreen = vertex.positionScreen;
|
||||
|
||||
positionWorld.copy( position ).applyMatrix4( _modelMatrix );
|
||||
positionScreen.copy( positionWorld ).applyMatrix4( _viewProjectionMatrix );
|
||||
|
||||
var invW = 1 / positionScreen.w;
|
||||
|
||||
positionScreen.x *= invW;
|
||||
positionScreen.y *= invW;
|
||||
positionScreen.z *= invW;
|
||||
|
||||
vertex.visible = positionScreen.x >= - 1 && positionScreen.x <= 1 &&
|
||||
positionScreen.y >= - 1 && positionScreen.y <= 1 &&
|
||||
positionScreen.z >= - 1 && positionScreen.z <= 1;
|
||||
|
||||
}
|
||||
|
||||
function pushVertex( x, y, z ) {
|
||||
|
||||
_vertex = getNextVertexInPool();
|
||||
_vertex.position.set( x, y, z );
|
||||
|
||||
projectVertex( _vertex );
|
||||
|
||||
}
|
||||
|
||||
function pushNormal( x, y, z ) {
|
||||
|
||||
normals.push( x, y, z );
|
||||
|
||||
}
|
||||
|
||||
function pushUv( x, y ) {
|
||||
|
||||
uvs.push( x, y );
|
||||
|
||||
}
|
||||
|
||||
function checkTriangleVisibility( v1, v2, v3 ) {
|
||||
|
||||
if ( v1.visible === true || v2.visible === true || v3.visible === true ) return true;
|
||||
|
||||
_points3[ 0 ] = v1.positionScreen;
|
||||
_points3[ 1 ] = v2.positionScreen;
|
||||
_points3[ 2 ] = v3.positionScreen;
|
||||
|
||||
return _clipBox.intersectsBox( _boundingBox.setFromPoints( _points3 ) );
|
||||
|
||||
}
|
||||
|
||||
function checkBackfaceCulling( v1, v2, v3 ) {
|
||||
|
||||
return ( ( v3.positionScreen.x - v1.positionScreen.x ) *
|
||||
( v2.positionScreen.y - v1.positionScreen.y ) -
|
||||
( v3.positionScreen.y - v1.positionScreen.y ) *
|
||||
( v2.positionScreen.x - v1.positionScreen.x ) ) < 0;
|
||||
|
||||
}
|
||||
|
||||
function pushLine( a, b ) {
|
||||
|
||||
var v1 = _vertexPool[ a ];
|
||||
var v2 = _vertexPool[ b ];
|
||||
|
||||
_line = getNextLineInPool();
|
||||
|
||||
_line.id = object.id;
|
||||
_line.v1.copy( v1 );
|
||||
_line.v2.copy( v2 );
|
||||
_line.z = ( v1.positionScreen.z + v2.positionScreen.z ) / 2;
|
||||
_line.renderOrder = object.renderOrder;
|
||||
|
||||
_line.material = object.material;
|
||||
|
||||
_renderData.elements.push( _line );
|
||||
|
||||
}
|
||||
|
||||
function pushTriangle( a, b, c ) {
|
||||
|
||||
var v1 = _vertexPool[ a ];
|
||||
var v2 = _vertexPool[ b ];
|
||||
var v3 = _vertexPool[ c ];
|
||||
|
||||
if ( checkTriangleVisibility( v1, v2, v3 ) === false ) return;
|
||||
|
||||
if ( material.side === THREE.DoubleSide || checkBackfaceCulling( v1, v2, v3 ) === true ) {
|
||||
|
||||
_face = getNextFaceInPool();
|
||||
|
||||
_face.id = object.id;
|
||||
_face.v1.copy( v1 );
|
||||
_face.v2.copy( v2 );
|
||||
_face.v3.copy( v3 );
|
||||
_face.z = ( v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z ) / 3;
|
||||
_face.renderOrder = object.renderOrder;
|
||||
|
||||
// use first vertex normal as face normal
|
||||
|
||||
_face.normalModel.fromArray( normals, a * 3 );
|
||||
_face.normalModel.applyMatrix3( normalMatrix ).normalize();
|
||||
|
||||
for ( var i = 0; i < 3; i ++ ) {
|
||||
|
||||
var normal = _face.vertexNormalsModel[ i ];
|
||||
normal.fromArray( normals, arguments[ i ] * 3 );
|
||||
normal.applyMatrix3( normalMatrix ).normalize();
|
||||
|
||||
var uv = _face.uvs[ i ];
|
||||
uv.fromArray( uvs, arguments[ i ] * 2 );
|
||||
|
||||
}
|
||||
|
||||
_face.vertexNormalsLength = 3;
|
||||
|
||||
_face.material = object.material;
|
||||
|
||||
_renderData.elements.push( _face );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
setObject: setObject,
|
||||
projectVertex: projectVertex,
|
||||
checkTriangleVisibility: checkTriangleVisibility,
|
||||
checkBackfaceCulling: checkBackfaceCulling,
|
||||
pushVertex: pushVertex,
|
||||
pushNormal: pushNormal,
|
||||
pushUv: pushUv,
|
||||
pushLine: pushLine,
|
||||
pushTriangle: pushTriangle
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var renderList = new RenderList();
|
||||
|
||||
this.projectScene = function ( scene, camera, sortObjects, sortElements ) {
|
||||
|
||||
_faceCount = 0;
|
||||
_lineCount = 0;
|
||||
_spriteCount = 0;
|
||||
|
||||
_renderData.elements.length = 0;
|
||||
|
||||
if ( scene.autoUpdate === true ) scene.updateMatrixWorld();
|
||||
if ( camera.parent === null ) camera.updateMatrixWorld();
|
||||
|
||||
_viewMatrix.copy( camera.matrixWorldInverse.getInverse( camera.matrixWorld ) );
|
||||
_viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, _viewMatrix );
|
||||
|
||||
_frustum.setFromMatrix( _viewProjectionMatrix );
|
||||
|
||||
//
|
||||
|
||||
_objectCount = 0;
|
||||
|
||||
_renderData.objects.length = 0;
|
||||
_renderData.lights.length = 0;
|
||||
|
||||
function addObject( object ) {
|
||||
|
||||
_object = getNextObjectInPool();
|
||||
_object.id = object.id;
|
||||
_object.object = object;
|
||||
|
||||
_vector3.setFromMatrixPosition( object.matrixWorld );
|
||||
_vector3.applyMatrix4( _viewProjectionMatrix );
|
||||
_object.z = _vector3.z;
|
||||
_object.renderOrder = object.renderOrder;
|
||||
|
||||
_renderData.objects.push( _object );
|
||||
|
||||
}
|
||||
|
||||
scene.traverseVisible( function ( object ) {
|
||||
|
||||
if ( object instanceof THREE.Light ) {
|
||||
|
||||
_renderData.lights.push( object );
|
||||
|
||||
} else if ( object instanceof THREE.Mesh || object instanceof THREE.Line ) {
|
||||
|
||||
if ( object.material.visible === false ) return;
|
||||
if ( object.frustumCulled === true && _frustum.intersectsObject( object ) === false ) return;
|
||||
|
||||
addObject( object );
|
||||
|
||||
} else if ( object instanceof THREE.Sprite ) {
|
||||
|
||||
if ( object.material.visible === false ) return;
|
||||
if ( object.frustumCulled === true && _frustum.intersectsSprite( object ) === false ) return;
|
||||
|
||||
addObject( object );
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
if ( sortObjects === true ) {
|
||||
|
||||
_renderData.objects.sort( painterSort );
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
for ( var o = 0, ol = _renderData.objects.length; o < ol; o ++ ) {
|
||||
|
||||
var object = _renderData.objects[ o ].object;
|
||||
var geometry = object.geometry;
|
||||
|
||||
renderList.setObject( object );
|
||||
|
||||
_modelMatrix = object.matrixWorld;
|
||||
|
||||
_vertexCount = 0;
|
||||
|
||||
if ( object instanceof THREE.Mesh ) {
|
||||
|
||||
if ( geometry instanceof THREE.BufferGeometry ) {
|
||||
|
||||
var attributes = geometry.attributes;
|
||||
var groups = geometry.groups;
|
||||
|
||||
if ( attributes.position === undefined ) continue;
|
||||
|
||||
var positions = attributes.position.array;
|
||||
|
||||
for ( var i = 0, l = positions.length; i < l; i += 3 ) {
|
||||
|
||||
renderList.pushVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
|
||||
|
||||
}
|
||||
|
||||
if ( attributes.normal !== undefined ) {
|
||||
|
||||
var normals = attributes.normal.array;
|
||||
|
||||
for ( var i = 0, l = normals.length; i < l; i += 3 ) {
|
||||
|
||||
renderList.pushNormal( normals[ i ], normals[ i + 1 ], normals[ i + 2 ] );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( attributes.uv !== undefined ) {
|
||||
|
||||
var uvs = attributes.uv.array;
|
||||
|
||||
for ( var i = 0, l = uvs.length; i < l; i += 2 ) {
|
||||
|
||||
renderList.pushUv( uvs[ i ], uvs[ i + 1 ] );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( geometry.index !== null ) {
|
||||
|
||||
var indices = geometry.index.array;
|
||||
|
||||
if ( groups.length > 0 ) {
|
||||
|
||||
for ( var g = 0; g < groups.length; g ++ ) {
|
||||
|
||||
var group = groups[ g ];
|
||||
|
||||
for ( var i = group.start, l = group.start + group.count; i < l; i += 3 ) {
|
||||
|
||||
renderList.pushTriangle( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for ( var i = 0, l = indices.length; i < l; i += 3 ) {
|
||||
|
||||
renderList.pushTriangle( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for ( var i = 0, l = positions.length / 3; i < l; i += 3 ) {
|
||||
|
||||
renderList.pushTriangle( i, i + 1, i + 2 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if ( geometry instanceof THREE.Geometry ) {
|
||||
|
||||
var vertices = geometry.vertices;
|
||||
var faces = geometry.faces;
|
||||
var faceVertexUvs = geometry.faceVertexUvs[ 0 ];
|
||||
|
||||
_normalMatrix.getNormalMatrix( _modelMatrix );
|
||||
|
||||
var material = object.material;
|
||||
|
||||
var isFaceMaterial = material instanceof THREE.MultiMaterial;
|
||||
var objectMaterials = isFaceMaterial === true ? object.material : null;
|
||||
|
||||
for ( var v = 0, vl = vertices.length; v < vl; v ++ ) {
|
||||
|
||||
var vertex = vertices[ v ];
|
||||
|
||||
_vector3.copy( vertex );
|
||||
|
||||
if ( material.morphTargets === true ) {
|
||||
|
||||
var morphTargets = geometry.morphTargets;
|
||||
var morphInfluences = object.morphTargetInfluences;
|
||||
|
||||
for ( var t = 0, tl = morphTargets.length; t < tl; t ++ ) {
|
||||
|
||||
var influence = morphInfluences[ t ];
|
||||
|
||||
if ( influence === 0 ) continue;
|
||||
|
||||
var target = morphTargets[ t ];
|
||||
var targetVertex = target.vertices[ v ];
|
||||
|
||||
_vector3.x += ( targetVertex.x - vertex.x ) * influence;
|
||||
_vector3.y += ( targetVertex.y - vertex.y ) * influence;
|
||||
_vector3.z += ( targetVertex.z - vertex.z ) * influence;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
renderList.pushVertex( _vector3.x, _vector3.y, _vector3.z );
|
||||
|
||||
}
|
||||
|
||||
for ( var f = 0, fl = faces.length; f < fl; f ++ ) {
|
||||
|
||||
var face = faces[ f ];
|
||||
|
||||
material = isFaceMaterial === true
|
||||
? objectMaterials.materials[ face.materialIndex ]
|
||||
: object.material;
|
||||
|
||||
if ( material === undefined ) continue;
|
||||
|
||||
var side = material.side;
|
||||
|
||||
var v1 = _vertexPool[ face.a ];
|
||||
var v2 = _vertexPool[ face.b ];
|
||||
var v3 = _vertexPool[ face.c ];
|
||||
|
||||
if ( renderList.checkTriangleVisibility( v1, v2, v3 ) === false ) continue;
|
||||
|
||||
var visible = renderList.checkBackfaceCulling( v1, v2, v3 );
|
||||
|
||||
if ( side !== THREE.DoubleSide ) {
|
||||
|
||||
if ( side === THREE.FrontSide && visible === false ) continue;
|
||||
if ( side === THREE.BackSide && visible === true ) continue;
|
||||
|
||||
}
|
||||
|
||||
_face = getNextFaceInPool();
|
||||
|
||||
_face.id = object.id;
|
||||
_face.v1.copy( v1 );
|
||||
_face.v2.copy( v2 );
|
||||
_face.v3.copy( v3 );
|
||||
|
||||
_face.normalModel.copy( face.normal );
|
||||
|
||||
if ( visible === false && ( side === THREE.BackSide || side === THREE.DoubleSide ) ) {
|
||||
|
||||
_face.normalModel.negate();
|
||||
|
||||
}
|
||||
|
||||
_face.normalModel.applyMatrix3( _normalMatrix ).normalize();
|
||||
|
||||
var faceVertexNormals = face.vertexNormals;
|
||||
|
||||
for ( var n = 0, nl = Math.min( faceVertexNormals.length, 3 ); n < nl; n ++ ) {
|
||||
|
||||
var normalModel = _face.vertexNormalsModel[ n ];
|
||||
normalModel.copy( faceVertexNormals[ n ] );
|
||||
|
||||
if ( visible === false && ( side === THREE.BackSide || side === THREE.DoubleSide ) ) {
|
||||
|
||||
normalModel.negate();
|
||||
|
||||
}
|
||||
|
||||
normalModel.applyMatrix3( _normalMatrix ).normalize();
|
||||
|
||||
}
|
||||
|
||||
_face.vertexNormalsLength = faceVertexNormals.length;
|
||||
|
||||
var vertexUvs = faceVertexUvs[ f ];
|
||||
|
||||
if ( vertexUvs !== undefined ) {
|
||||
|
||||
for ( var u = 0; u < 3; u ++ ) {
|
||||
|
||||
_face.uvs[ u ].copy( vertexUvs[ u ] );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_face.color = face.color;
|
||||
_face.material = material;
|
||||
|
||||
_face.z = ( v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z ) / 3;
|
||||
_face.renderOrder = object.renderOrder;
|
||||
|
||||
_renderData.elements.push( _face );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if ( object instanceof THREE.Line ) {
|
||||
|
||||
if ( geometry instanceof THREE.BufferGeometry ) {
|
||||
|
||||
var attributes = geometry.attributes;
|
||||
|
||||
if ( attributes.position !== undefined ) {
|
||||
|
||||
var positions = attributes.position.array;
|
||||
|
||||
for ( var i = 0, l = positions.length; i < l; i += 3 ) {
|
||||
|
||||
renderList.pushVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
|
||||
|
||||
}
|
||||
|
||||
if ( geometry.index !== null ) {
|
||||
|
||||
var indices = geometry.index.array;
|
||||
|
||||
for ( var i = 0, l = indices.length; i < l; i += 2 ) {
|
||||
|
||||
renderList.pushLine( indices[ i ], indices[ i + 1 ] );
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
var step = object instanceof THREE.LineSegments ? 2 : 1;
|
||||
|
||||
for ( var i = 0, l = ( positions.length / 3 ) - 1; i < l; i += step ) {
|
||||
|
||||
renderList.pushLine( i, i + 1 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if ( geometry instanceof THREE.Geometry ) {
|
||||
|
||||
_modelViewProjectionMatrix.multiplyMatrices( _viewProjectionMatrix, _modelMatrix );
|
||||
|
||||
var vertices = object.geometry.vertices;
|
||||
|
||||
if ( vertices.length === 0 ) continue;
|
||||
|
||||
v1 = getNextVertexInPool();
|
||||
v1.positionScreen.copy( vertices[ 0 ] ).applyMatrix4( _modelViewProjectionMatrix );
|
||||
|
||||
var step = object instanceof THREE.LineSegments ? 2 : 1;
|
||||
|
||||
for ( var v = 1, vl = vertices.length; v < vl; v ++ ) {
|
||||
|
||||
v1 = getNextVertexInPool();
|
||||
v1.positionScreen.copy( vertices[ v ] ).applyMatrix4( _modelViewProjectionMatrix );
|
||||
|
||||
if ( ( v + 1 ) % step > 0 ) continue;
|
||||
|
||||
v2 = _vertexPool[ _vertexCount - 2 ];
|
||||
|
||||
_clippedVertex1PositionScreen.copy( v1.positionScreen );
|
||||
_clippedVertex2PositionScreen.copy( v2.positionScreen );
|
||||
|
||||
if ( clipLine( _clippedVertex1PositionScreen, _clippedVertex2PositionScreen ) === true ) {
|
||||
|
||||
// Perform the perspective divide
|
||||
_clippedVertex1PositionScreen.multiplyScalar( 1 / _clippedVertex1PositionScreen.w );
|
||||
_clippedVertex2PositionScreen.multiplyScalar( 1 / _clippedVertex2PositionScreen.w );
|
||||
|
||||
_line = getNextLineInPool();
|
||||
|
||||
_line.id = object.id;
|
||||
_line.v1.positionScreen.copy( _clippedVertex1PositionScreen );
|
||||
_line.v2.positionScreen.copy( _clippedVertex2PositionScreen );
|
||||
|
||||
_line.z = Math.max( _clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z );
|
||||
_line.renderOrder = object.renderOrder;
|
||||
|
||||
_line.material = object.material;
|
||||
|
||||
if ( object.material.vertexColors === THREE.VertexColors ) {
|
||||
|
||||
_line.vertexColors[ 0 ].copy( object.geometry.colors[ v ] );
|
||||
_line.vertexColors[ 1 ].copy( object.geometry.colors[ v - 1 ] );
|
||||
|
||||
}
|
||||
|
||||
_renderData.elements.push( _line );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if ( object instanceof THREE.Sprite ) {
|
||||
|
||||
_vector4.set( _modelMatrix.elements[ 12 ], _modelMatrix.elements[ 13 ], _modelMatrix.elements[ 14 ], 1 );
|
||||
_vector4.applyMatrix4( _viewProjectionMatrix );
|
||||
|
||||
var invW = 1 / _vector4.w;
|
||||
|
||||
_vector4.z *= invW;
|
||||
|
||||
if ( _vector4.z >= - 1 && _vector4.z <= 1 ) {
|
||||
|
||||
_sprite = getNextSpriteInPool();
|
||||
_sprite.id = object.id;
|
||||
_sprite.x = _vector4.x * invW;
|
||||
_sprite.y = _vector4.y * invW;
|
||||
_sprite.z = _vector4.z;
|
||||
_sprite.renderOrder = object.renderOrder;
|
||||
_sprite.object = object;
|
||||
|
||||
_sprite.rotation = object.rotation;
|
||||
|
||||
_sprite.scale.x = object.scale.x * Math.abs( _sprite.x - ( _vector4.x + camera.projectionMatrix.elements[ 0 ] ) / ( _vector4.w + camera.projectionMatrix.elements[ 12 ] ) );
|
||||
_sprite.scale.y = object.scale.y * Math.abs( _sprite.y - ( _vector4.y + camera.projectionMatrix.elements[ 5 ] ) / ( _vector4.w + camera.projectionMatrix.elements[ 13 ] ) );
|
||||
|
||||
_sprite.material = object.material;
|
||||
|
||||
_renderData.elements.push( _sprite );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( sortElements === true ) {
|
||||
|
||||
_renderData.elements.sort( painterSort );
|
||||
|
||||
}
|
||||
|
||||
return _renderData;
|
||||
|
||||
};
|
||||
|
||||
// Pools
|
||||
|
||||
function getNextObjectInPool() {
|
||||
|
||||
if ( _objectCount === _objectPoolLength ) {
|
||||
|
||||
var object = new THREE.RenderableObject();
|
||||
_objectPool.push( object );
|
||||
_objectPoolLength ++;
|
||||
_objectCount ++;
|
||||
return object;
|
||||
|
||||
}
|
||||
|
||||
return _objectPool[ _objectCount ++ ];
|
||||
|
||||
}
|
||||
|
||||
function getNextVertexInPool() {
|
||||
|
||||
if ( _vertexCount === _vertexPoolLength ) {
|
||||
|
||||
var vertex = new THREE.RenderableVertex();
|
||||
_vertexPool.push( vertex );
|
||||
_vertexPoolLength ++;
|
||||
_vertexCount ++;
|
||||
return vertex;
|
||||
|
||||
}
|
||||
|
||||
return _vertexPool[ _vertexCount ++ ];
|
||||
|
||||
}
|
||||
|
||||
function getNextFaceInPool() {
|
||||
|
||||
if ( _faceCount === _facePoolLength ) {
|
||||
|
||||
var face = new THREE.RenderableFace();
|
||||
_facePool.push( face );
|
||||
_facePoolLength ++;
|
||||
_faceCount ++;
|
||||
return face;
|
||||
|
||||
}
|
||||
|
||||
return _facePool[ _faceCount ++ ];
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getNextLineInPool() {
|
||||
|
||||
if ( _lineCount === _linePoolLength ) {
|
||||
|
||||
var line = new THREE.RenderableLine();
|
||||
_linePool.push( line );
|
||||
_linePoolLength ++;
|
||||
_lineCount ++;
|
||||
return line;
|
||||
|
||||
}
|
||||
|
||||
return _linePool[ _lineCount ++ ];
|
||||
|
||||
}
|
||||
|
||||
function getNextSpriteInPool() {
|
||||
|
||||
if ( _spriteCount === _spritePoolLength ) {
|
||||
|
||||
var sprite = new THREE.RenderableSprite();
|
||||
_spritePool.push( sprite );
|
||||
_spritePoolLength ++;
|
||||
_spriteCount ++;
|
||||
return sprite;
|
||||
|
||||
}
|
||||
|
||||
return _spritePool[ _spriteCount ++ ];
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
function painterSort( a, b ) {
|
||||
|
||||
if ( a.renderOrder !== b.renderOrder ) {
|
||||
|
||||
return a.renderOrder - b.renderOrder;
|
||||
|
||||
} else if ( a.z !== b.z ) {
|
||||
|
||||
return b.z - a.z;
|
||||
|
||||
} else if ( a.id !== b.id ) {
|
||||
|
||||
return a.id - b.id;
|
||||
|
||||
} else {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function clipLine( s1, s2 ) {
|
||||
|
||||
var alpha1 = 0, alpha2 = 1,
|
||||
|
||||
// Calculate the boundary coordinate of each vertex for the near and far clip planes,
|
||||
// Z = -1 and Z = +1, respectively.
|
||||
bc1near = s1.z + s1.w,
|
||||
bc2near = s2.z + s2.w,
|
||||
bc1far = - s1.z + s1.w,
|
||||
bc2far = - s2.z + s2.w;
|
||||
|
||||
if ( bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0 ) {
|
||||
|
||||
// Both vertices lie entirely within all clip planes.
|
||||
return true;
|
||||
|
||||
} else if ( ( bc1near < 0 && bc2near < 0 ) || ( bc1far < 0 && bc2far < 0 ) ) {
|
||||
|
||||
// Both vertices lie entirely outside one of the clip planes.
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
// The line segment spans at least one clip plane.
|
||||
|
||||
if ( bc1near < 0 ) {
|
||||
|
||||
// v1 lies outside the near plane, v2 inside
|
||||
alpha1 = Math.max( alpha1, bc1near / ( bc1near - bc2near ) );
|
||||
|
||||
} else if ( bc2near < 0 ) {
|
||||
|
||||
// v2 lies outside the near plane, v1 inside
|
||||
alpha2 = Math.min( alpha2, bc1near / ( bc1near - bc2near ) );
|
||||
|
||||
}
|
||||
|
||||
if ( bc1far < 0 ) {
|
||||
|
||||
// v1 lies outside the far plane, v2 inside
|
||||
alpha1 = Math.max( alpha1, bc1far / ( bc1far - bc2far ) );
|
||||
|
||||
} else if ( bc2far < 0 ) {
|
||||
|
||||
// v2 lies outside the far plane, v2 inside
|
||||
alpha2 = Math.min( alpha2, bc1far / ( bc1far - bc2far ) );
|
||||
|
||||
}
|
||||
|
||||
if ( alpha2 < alpha1 ) {
|
||||
|
||||
// The line segment spans two boundaries, but is outside both of them.
|
||||
// (This can't happen when we're only clipping against just near/far but good
|
||||
// to leave the check here for future usage if other clip planes are added.)
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
// Update the s1 and s2 vertices to match the clipped line segment.
|
||||
s1.lerp( s2, alpha1 );
|
||||
s2.lerp( s1, 1 - alpha2 );
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
1
lib/three/package.json
Normal file
1
lib/three/package.json
Normal file
@@ -0,0 +1 @@
|
||||
{"name":"theme-next-three","version":"1.0.0","main":"index.js","repository":"git@github.com:theme-next/theme-next-three.git","author":"Raincal <cyj94228@gmail.com>","license":"MIT","scripts":{"build":"gulp"},"dependencies":{"del":"^5.1.0","gulp":"^4.0.2","gulp-concat":"^2.6.1","gulp-uglify":"^3.0.2"}}
|
||||
1
lib/three/renovate.json
Normal file
1
lib/three/renovate.json
Normal file
@@ -0,0 +1 @@
|
||||
{"extends":["config:base"]}
|
||||
114
lib/three/src/canvas_lines.js
Normal file
114
lib/three/src/canvas_lines.js
Normal file
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* Created by Tang on 2017/4/15.
|
||||
*/
|
||||
$(function () {
|
||||
var mouseX = 0,
|
||||
mouseY = 0,
|
||||
windowHalfX = window.innerWidth / 2,
|
||||
windowHalfY = window.innerHeight / 2,
|
||||
SEPARATION = 200,
|
||||
AMOUNTX = 10,
|
||||
AMOUNTY = 10,
|
||||
camera, scene, renderer;
|
||||
init();
|
||||
animate();
|
||||
|
||||
function init() {
|
||||
var container, separation = 100,
|
||||
amountX = 50,
|
||||
amountY = 50,
|
||||
particles, particle;
|
||||
container = document.createElement('div');
|
||||
// 设置css
|
||||
container.style.position = "fixed";
|
||||
container.style.top = "0px";
|
||||
container.style.left = "0px";
|
||||
container.style.zIndex = "-1";
|
||||
container.style.opacity = "0.5";
|
||||
|
||||
document.body.appendChild(container);
|
||||
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000);
|
||||
camera.position.z = 100;
|
||||
scene = new THREE.Scene();
|
||||
renderer = new THREE.CanvasRenderer({
|
||||
alpha: true
|
||||
});
|
||||
renderer.setPixelRatio(window.devicePixelRatio);
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
container.appendChild(renderer.domElement);
|
||||
// particles
|
||||
var PI2 = Math.PI * 2;
|
||||
var material = new THREE.SpriteCanvasMaterial({
|
||||
color: 10263708,
|
||||
program: function (context) {
|
||||
context.beginPath();
|
||||
context.arc(0, 0, 0.5, 0, PI2, true);
|
||||
context.fill();
|
||||
}
|
||||
});
|
||||
var geometry = new THREE.Geometry();
|
||||
for (var i = 0; i < 100; i++) {
|
||||
particle = new THREE.Sprite(material);
|
||||
particle.position.x = Math.random() * 2 - 1;
|
||||
particle.position.y = Math.random() * 2 - 1;
|
||||
particle.position.z = Math.random() * 2 - 1;
|
||||
particle.position.normalize();
|
||||
particle.position.multiplyScalar(Math.random() * 10 + 450);
|
||||
particle.scale.x = particle.scale.y = 10;
|
||||
scene.add(particle);
|
||||
geometry.vertices.push(particle.position);
|
||||
}
|
||||
// lines
|
||||
var line = new THREE.Line(geometry, new THREE.LineBasicMaterial({
|
||||
color: 10263708,
|
||||
opacity: 0.5
|
||||
}));
|
||||
scene.add(line);
|
||||
document.addEventListener('mousemove', onDocumentMouseMove, false);
|
||||
document.addEventListener('touchstart', onDocumentTouchStart, false);
|
||||
document.addEventListener('touchmove', onDocumentTouchMove, false);
|
||||
//
|
||||
window.addEventListener('resize', onWindowResize, false);
|
||||
}
|
||||
|
||||
function onWindowResize() {
|
||||
windowHalfX = window.innerWidth / 2;
|
||||
windowHalfY = window.innerHeight / 2;
|
||||
camera.aspect = window.innerWidth / window.innerHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
}
|
||||
//
|
||||
function onDocumentMouseMove(event) {
|
||||
mouseX = event.clientX - windowHalfX;
|
||||
mouseY = event.clientY - windowHalfY;
|
||||
}
|
||||
|
||||
function onDocumentTouchStart(event) {
|
||||
if (event.touches.length > 1) {
|
||||
//event.preventDefault();
|
||||
mouseX = event.touches[0].pageX - windowHalfX;
|
||||
//mouseY = event.touches[ 0 ].pageY - windowHalfY;
|
||||
}
|
||||
}
|
||||
|
||||
function onDocumentTouchMove(event) {
|
||||
if (event.touches.length == 1) {
|
||||
//event.preventDefault();
|
||||
mouseX = event.touches[0].pageX - windowHalfX;
|
||||
//mouseY = event.touches[ 0 ].pageY - windowHalfY;
|
||||
}
|
||||
}
|
||||
//
|
||||
function animate() {
|
||||
requestAnimationFrame(animate);
|
||||
render();
|
||||
}
|
||||
|
||||
function render() {
|
||||
camera.position.x += (mouseX - camera.position.x) * .05;
|
||||
camera.position.y += (-mouseY + 200 - camera.position.y) * .05;
|
||||
camera.lookAt(scene.position);
|
||||
renderer.render(scene, camera);
|
||||
}
|
||||
})
|
||||
124
lib/three/src/canvas_sphere.js
Normal file
124
lib/three/src/canvas_sphere.js
Normal file
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* Created by Tang on 2017/4/15.
|
||||
*/
|
||||
$(function () {
|
||||
var SCREEN_WIDTH = window.innerWidth,
|
||||
SCREEN_HEIGHT = window.innerHeight,
|
||||
mouseX = 0,
|
||||
mouseY = 0,
|
||||
windowHalfX = window.innerWidth / 2,
|
||||
windowHalfY = window.innerHeight / 2,
|
||||
SEPARATION = 200,
|
||||
AMOUNTX = 10,
|
||||
AMOUNTY = 10,
|
||||
camera, scene, renderer;
|
||||
init();
|
||||
animate();
|
||||
|
||||
function init() {
|
||||
var container, separation = 100,
|
||||
amountX = 50,
|
||||
amountY = 50,
|
||||
particles, particle;
|
||||
container = document.createElement('div');
|
||||
// 设置css
|
||||
container.style.position = "fixed";
|
||||
container.style.top = "0px";
|
||||
container.style.left = "0px";
|
||||
container.style.zIndex = "-1";
|
||||
container.style.opacity = "0.5";
|
||||
|
||||
document.body.appendChild(container);
|
||||
camera = new THREE.PerspectiveCamera(75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000);
|
||||
camera.position.z = 1000;
|
||||
scene = new THREE.Scene();
|
||||
renderer = new THREE.CanvasRenderer({
|
||||
alpha: true
|
||||
});
|
||||
renderer.setPixelRatio(window.devicePixelRatio);
|
||||
renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
container.appendChild(renderer.domElement);
|
||||
// particles
|
||||
var PI2 = Math.PI * 2;
|
||||
var material = new THREE.SpriteCanvasMaterial({
|
||||
color: 10263708,
|
||||
program: function (context) {
|
||||
context.beginPath();
|
||||
context.arc(0, 0, 0.5, 0, PI2, true);
|
||||
context.fill();
|
||||
}
|
||||
});
|
||||
for (var i = 0; i < 1000; i++) {
|
||||
particle = new THREE.Sprite(material);
|
||||
particle.position.x = Math.random() * 2 - 1;
|
||||
particle.position.y = Math.random() * 2 - 1;
|
||||
particle.position.z = Math.random() * 2 - 1;
|
||||
particle.position.normalize();
|
||||
particle.position.multiplyScalar(Math.random() * 10 + 450);
|
||||
particle.scale.multiplyScalar(2);
|
||||
scene.add(particle);
|
||||
}
|
||||
// lines
|
||||
for (var i = 0; i < 300; i++) {
|
||||
var geometry = new THREE.Geometry();
|
||||
var vertex = new THREE.Vector3(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1);
|
||||
vertex.normalize();
|
||||
vertex.multiplyScalar(450);
|
||||
geometry.vertices.push(vertex);
|
||||
var vertex2 = vertex.clone();
|
||||
vertex2.multiplyScalar(Math.random() * 0.3 + 1);
|
||||
geometry.vertices.push(vertex2);
|
||||
var line = new THREE.Line(geometry, new THREE.LineBasicMaterial({
|
||||
color: 10263708,
|
||||
opacity: Math.random()
|
||||
}));
|
||||
scene.add(line);
|
||||
}
|
||||
document.addEventListener('mousemove', onDocumentMouseMove, false);
|
||||
document.addEventListener('touchstart', onDocumentTouchStart, false);
|
||||
document.addEventListener('touchmove', onDocumentTouchMove, false);
|
||||
//
|
||||
window.addEventListener('resize', onWindowResize, false);
|
||||
}
|
||||
|
||||
function onWindowResize() {
|
||||
windowHalfX = window.innerWidth / 2;
|
||||
windowHalfY = window.innerHeight / 2;
|
||||
camera.aspect = window.innerWidth / window.innerHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
}
|
||||
//
|
||||
function onDocumentMouseMove(event) {
|
||||
mouseX = event.clientX - windowHalfX;
|
||||
mouseY = event.clientY - windowHalfY;
|
||||
}
|
||||
|
||||
function onDocumentTouchStart(event) {
|
||||
if (event.touches.length > 1) {
|
||||
//event.preventDefault();
|
||||
mouseX = event.touches[0].pageX - windowHalfX;
|
||||
//mouseY = event.touches[ 0 ].pageY - windowHalfY;
|
||||
}
|
||||
}
|
||||
|
||||
function onDocumentTouchMove(event) {
|
||||
if (event.touches.length == 1) {
|
||||
//event.preventDefault();
|
||||
mouseX = event.touches[0].pageX - windowHalfX;
|
||||
//mouseY = event.touches[ 0 ].pageY - windowHalfY;
|
||||
}
|
||||
}
|
||||
//
|
||||
function animate() {
|
||||
requestAnimationFrame(animate);
|
||||
render();
|
||||
}
|
||||
|
||||
function render() {
|
||||
camera.position.x += (mouseX - camera.position.x) * .05;
|
||||
camera.position.y += (-mouseY + 200 - camera.position.y) * .05;
|
||||
camera.lookAt(scene.position);
|
||||
renderer.render(scene, camera);
|
||||
}
|
||||
})
|
||||
91
lib/three/src/three-waves.js
Normal file
91
lib/three/src/three-waves.js
Normal file
@@ -0,0 +1,91 @@
|
||||
$(function () {
|
||||
var SEPARATION = 100,
|
||||
AMOUNTX = 50,
|
||||
AMOUNTY = 50;
|
||||
var container;
|
||||
var camera, scene, renderer;
|
||||
var particles, particle, count = 0;
|
||||
var mouseX = 0,
|
||||
mouseY = 0;
|
||||
var windowHalfX = window.innerWidth / 2;
|
||||
var windowHalfY = window.innerHeight / 2;
|
||||
init();
|
||||
animate();
|
||||
|
||||
function init() {
|
||||
container = document.createElement("div");
|
||||
container.style.position = "fixed";
|
||||
container.style.top = "0px";
|
||||
container.style.left = "0px";
|
||||
container.style.zIndex = "-1";
|
||||
container.style.opacity = "0.5";
|
||||
document.body.appendChild(container);
|
||||
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000);
|
||||
camera.position.z = 1000;
|
||||
scene = new THREE.Scene();
|
||||
particles = new Array();
|
||||
var PI2 = Math.PI * 2;
|
||||
var material = new THREE.SpriteCanvasMaterial({
|
||||
color: 10263708,
|
||||
program: function (context) {
|
||||
context.beginPath();
|
||||
context.arc(0, 0, 0.5, 0, PI2, true);
|
||||
context.fill()
|
||||
}
|
||||
});
|
||||
var i = 0;
|
||||
for (var ix = 0; ix < AMOUNTX; ix++) {
|
||||
for (var iy = 0; iy < AMOUNTY; iy++) {
|
||||
particle = particles[i++] = new THREE.Sprite(material);
|
||||
particle.position.x = ix * SEPARATION - ((AMOUNTX * SEPARATION) / 2);
|
||||
particle.position.z = iy * SEPARATION - ((AMOUNTY * SEPARATION) / 2);
|
||||
scene.add(particle)
|
||||
}
|
||||
}
|
||||
renderer = new THREE.CanvasRenderer({
|
||||
alpha: true
|
||||
});
|
||||
renderer.setPixelRatio(window.devicePixelRatio);
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
container.appendChild(renderer.domElement);
|
||||
document.addEventListener("mousemove", onDocumentMouseMove, false);
|
||||
window.addEventListener("resize", onWindowResize, false)
|
||||
}
|
||||
|
||||
function onWindowResize() {
|
||||
windowHalfX = window.innerWidth / 2;
|
||||
windowHalfY = window.innerHeight / 2;
|
||||
camera.aspect = window.innerWidth / window.innerHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
renderer.setSize(window.innerWidth, window.innerHeight)
|
||||
}
|
||||
|
||||
function onDocumentMouseMove(event) {
|
||||
mouseX = event.clientX - windowHalfX
|
||||
}
|
||||
|
||||
function animate() {
|
||||
requestAnimationFrame(animate);
|
||||
render()
|
||||
}
|
||||
|
||||
function render() {
|
||||
camera.position.x += (mouseX - camera.position.x) * 0.05;
|
||||
camera.position.y = 362.05;
|
||||
camera.lookAt({
|
||||
x: scene.position.x,
|
||||
y: window.innerHeight / 3,
|
||||
z: scene.position.z
|
||||
});
|
||||
var i = 0;
|
||||
for (var ix = 0; ix < AMOUNTX; ix++) {
|
||||
for (var iy = 0; iy < AMOUNTY; iy++) {
|
||||
particle = particles[i++];
|
||||
particle.position.y = (Math.sin((ix + count) * 0.3) * 50) + (Math.sin((iy + count) * 0.5) * 50);
|
||||
particle.scale.x = particle.scale.y = (Math.sin((ix + count) * 0.3) + 1) * 4 + (Math.sin((iy + count) * 0.5) + 1) * 4
|
||||
}
|
||||
}
|
||||
renderer.render(scene, camera);
|
||||
count += 0.1
|
||||
}
|
||||
});
|
||||
2
lib/three/three-waves.min.js
vendored
Normal file
2
lib/three/three-waves.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
859
lib/three/three.min.js
vendored
Normal file
859
lib/three/three.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
lib/velocity/velocity.min.js
vendored
Normal file
4
lib/velocity/velocity.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
lib/velocity/velocity.ui.min.js
vendored
Normal file
2
lib/velocity/velocity.ui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user