initial commit

This commit is contained in:
Kim, Jimin 2021-02-13 16:02:10 +09:00
commit 60444b4120
30 changed files with 50490 additions and 0 deletions

161
.gitignore vendored Normal file
View file

@ -0,0 +1,161 @@
_/
yarn.lock
package-lock.json
hexo/source/_drafts
# unaltered
# Created by https://www.toptal.com/developers/gitignore/api/firebase,node,hexo,git,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=firebase,node,hexo,git,visualstudiocode
### Firebase ###
.idea
**/node_modules/*
**/.firebaserc
### Firebase Patch ###
.runtimeconfig.json
.firebase/
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
### Hexo ###
db.json
public/
.deploy_git/
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
.env*.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
### VisualStudioCode ###
.vscode/*
!.vscode/tasks.json
!.vscode/launch.json
*.code-workspace
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# End of https://www.toptal.com/developers/gitignore/api/firebase,node,hexo,git,visualstudiocode

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "hexo/themes/icarus"]
path = hexo/themes/icarus
url = https://github.com/developomp/hexo-theme-icarus.git

0
.prettierrc.js Normal file
View file

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 developomp
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.

21
README.md Normal file
View file

@ -0,0 +1,21 @@
# [developomp.com](https://developomp.com)
Tools used:
| Name | Use |
| --------------------------------------: | :-------------------------------------- |
| [Hexo](https://hexo.io) | generating static files |
| [Firebase](https://firebase.google.com) | hosting site (Future: hosting database) |
| [Github](https://github.com) | storing source & automatic deployment |
| [AWS](https://aws.amazon.com) | Domain name purchase & management |
# Setup
- Clone the repo
- Install dependencies
- Generate
# License
This project is licensed under the MIT License.\
Check the [LICENSE file](./LICENSE) for more information.

11
firebase.json Normal file
View file

@ -0,0 +1,11 @@
{
"hosting": {
"cleanUrls": true,
"public": "hexo/public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}

363
hexo/_config.icarus.yml Normal file
View file

@ -0,0 +1,363 @@
# Version of the configuration file
version: 4.0.0
# Icarus theme variant, can be "default" or "cyberpunk"
variant: default
# Path or URL to the website's logo
logo: /img/icon_circle.svg
# Page metadata configurations
head:
# URL or path to the website's icon
favicon: /img/icon_circle.svg
# Web application manifests configuration
# https://developer.mozilla.org/en-US/docs/Web/Manifest
manifest:
# Name of the web application (default to the site title)
name:
# The displayed name of the web application
# when there is not enough space to display full name
short_name:
# The start URL of the web application
start_url:
# The default theme color for the application
theme_color:
# A placeholder background color for the application page to display
# before its stylesheet is loaded
background_color:
# The preferred display mode for the website
display: standalone
# Image files that can serve as application icons for different contexts
icons:
-
# The path to the image file
src: ''
# A string containing space-separated image dimensions
sizes: ''
# A hint as to the media type of the image
type:
# Open Graph metadata
# https://hexo.io/docs/helpers.html#open-graph
open_graph:
# Page title (og:title) (optional)
# You should leave this blank for most of the time
title:
# Page type (og:type) (optional)
# You should leave this blank for most of the time
type: blog
# Page URL (og:url) (optional)
# You should leave this blank for most of the time
url:
# Page cover (og:image) (optional)
# You should leave this blank for most of the time
image:
# Site name (og:site_name) (optional)
# You should leave this blank for most of the time
site_name:
# Page author (article:author) (optional)
# You should leave this blank for most of the time
author:
# Page description (og:description) (optional)
# You should leave this blank for most of the time
description:
# Twitter card type (twitter:card)
twitter_card:
# Twitter ID (twitter:creator)
twitter_id:
# Twitter Site (twitter:site)
twitter_site:
# Google+ profile link (deprecated)
google_plus:
# Facebook admin ID
fb_admins:
# Facebook App ID
fb_app_id:
# Structured data of the page
# https://developers.google.com/search/docs/guides/intro-structured-data
structured_data:
# Page title (optional)
# You should leave this blank for most of the time
title:
# Page description (optional)
# You should leave this blank for most of the time
description:
# Page URL (optional)
# You should leave this blank for most of the time
url:
# Page author (article:author) (optional)
# You should leave this blank for most of the time
author:
# Page images (optional)
# You should leave this blank for most of the time
image:
# Additional HTML meta tags in an array
meta:
# Meta tag specified in <attribute>=<value> style
# E.g., name=theme-color;content=#123456 => <meta name="theme-color" content="#123456">
- ''
# URL or path to the website's RSS atom.xml
rss:
# Page top navigation bar configurations
navbar:
# Navigation menu items
menu:
Home: /
Archives: /archives
Categories: /categories
Tags: /tags
Explore: /explore
# Links to be shown on the right of the navigation bar
links:
RSS feed:
icon: fas fa-rss
url: /feed
View source:
icon: fab fa-github
url: 'https://github.com/developomp/developomp-site'
# Page footer configurations
footer:
# Links to be shown on the right of the footer section
links:
Creative Commons:
icon: fab fa-creative-commons
url: 'https://creativecommons.org/'
Attribution:
icon: fab fa-creative-commons-by
url: 'https://creativecommons.org/licenses/by/4.0/'
## Custom ##
email: 'developomp@gmail.com'
## Custom ##
# Article related configurations
article:
# Code highlight settings
highlight:
# Code highlight themes
# https://github.com/highlightjs/highlight.js/tree/master/src/styles
theme: atom-one-light
# Show copy code button
clipboard: true
# Default folding status of the code blocks. Can be "", "folded", "unfolded"
fold: unfolded
# Whether to show estimated article reading time
readtime: true
# Article licensing block
# licenses:
# Creative Commons:
# icon: fab fa-creative-commons
# url: 'https://creativecommons.org/'
# Attribution:
# icon: fab fa-creative-commons-by
# url: 'https://creativecommons.org/licenses/by/4.0/'
# Search plugin configurations
# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Search/
search:
type: insight
# Comment plugin configurations
# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Comment/
# comment:
# type: disqus
# Disqus shortname
# shortname: 'developomp'
# Donate plugin configurations
# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Donation/
# donates:
# "Buy me a coffee" donate button configurations
# -
# type: buymeacoffee
# # URL to the "Buy me a coffee" page
# url: ''
# Patreon donate button configurations
# -
# type: patreon
# # URL to the Patreon page
# url: ''
# Paypal donate button configurations
# -
# type: paypal
# # Paypal business ID or email address
# business: ''
# # Currency code
# currency_code: USD
# Share plugin configurations
# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Share/
# share:
# type: sharethis
# # URL to the ShareThis share plugin script
# install_url: ''
# Sidebar configurations.
# Please be noted that a sidebar is only visible when it has at least one widget
sidebar:
# Left sidebar configurations
left:
# Whether the sidebar sticks to the top when page scrolls
sticky: false
# Right sidebar configurations
right:
# Whether the sidebar sticks to the top when page scrolls
sticky: false
# Sidebar widget configurations
# http://ppoffice.github.io/hexo-theme-icarus/categories/Widgets/
widgets:
# Profile widget configurations
# -
# Where should the widget be placed, left sidebar or right sidebar
# position: left
# type: profile
# Author name
# author: developomp
# Author title
# author_title:
# Author's current location
# location: South Korea
# URL or path to the avatar image
# avatar: /img/icon.svg
# Whether show the rounded avatar image
# avatar_rounded: true
# Email address for the Gravatar
# gravatar:
# URL or path for the follow button
# follow_link:
# Links to be shown on the bottom of the profile widget
# social_links:
# Github:
# icon: fab fa-github
# url: 'https://github.com/developomp'
# RSS:
# icon: fas fa-rss
# url: /feed
# Table of contents widget configurations
-
# Where should the widget be placed, left sidebar or right sidebar
position: left
type: toc
# Whether to show the index of each heading
index: true
# Recommendation links widget configurations
# -
# # Where should the widget be placed, left sidebar or right sidebar
# position: left
# type: links
# # Names and URLs of the sites
# links:
# Hexo: 'https://hexo.io'
# Bulma: 'https://bulma.io'
# Categories widget configurations
-
# Where should the widget be placed, left sidebar or right sidebar
position: left
type: categories
# Recent posts widget configurations
-
# Where should the widget be placed, left sidebar or right sidebar
position: left
type: recent_posts
# Archives widget configurations
-
# Where should the widget be placed, left sidebar or right sidebar
position: left
type: archives
# Tags widget configurations
-
# Where should the widget be placed, left sidebar or right sidebar
position: left
type: tags
# Google FeedBurner email subscription widget configurations
# -
# # Where should the widget be placed, left sidebar or right sidebar
# position: left
# type: subscribe_email
# # Hint text under the email input
# description:
# # Feedburner ID
# feedburner_id: ''
# Google AdSense unit configurations
# -
# # Where should the widget be placed, left sidebar or right sidebar
# position: left
# type: adsense
# # AdSense client ID
# client_id: ''
# # AdSense AD unit ID
# slot_id: ''
# Plugin configurations
# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/
plugins:
# Enable page startup animations
animejs: true
# Show the "back to top" button
back_to_top: true
# Baidu Analytics plugin settings
# https://tongji.baidu.com
# baidu_analytics:
# Baidu Analytics tracking ID
# tracking_id:
# Bing Webmaster Tools plugin settings
# https://www.bing.com/toolbox/webmaster/
# bing_webmaster:
# Bing Webmaster Tools tracking ID in the <meta> tag
# tracking_id:
# BuSuanZi site/page view counter
# https://busuanzi.ibruce.info
busuanzi: false
# CNZZ statistics
# https://www.umeng.com/web
# cnzz:
# CNZZ tracker id
# id:
# CNZZ website id
# web_id:
# Alerting users about the use of cookies
# https://www.osano.com/cookieconsent/
cookie_consent:
# The compliance type. Can be "info", "opt-in", or "opt-out"
type: info
# Theme of the popup. Can be "block", "edgeless", or "classic"
theme: edgeless
# Whether the popup should stay static regardless of the page scrolls
static: false
# Where on the screen the consent popup should display
position: bottom-left
# URL to your site's cookie policy
policyLink: 'https://www.cookiesandyou.com/'
# Enable the lightGallery and Justified Gallery plugins
gallery: true
# Google Analytics plugin settings
# https://analytics.google.com
google_analytics:
# Google Analytics tracking ID
tracking_id:
# Hotjar user feedback plugin
# https://www.hotjar.com/
hotjar:
# Hotjar site id
site_id:
# Enable the KaTeX math typesetting support
# https://katex.org/
katex: false
# Enable the MathJax math typesetting support
# https://www.mathjax.org/
mathjax: false
# Enable the Outdated Browser plugin
# http://outdatedbrowser.com/
outdated_browser: false
# Show a progress bar at top of the page on page loading
progressbar: true
# Statcounter statistics
# https://statcounter.com/
statcounter:
# Statcounter project id
project:
# Statcounter project security code
security:
# Twitter conversion tracking plugin settings
# https://business.twitter.com/en/help/campaign-measurement-and-analytics/conversion-tracking-for-websites.html
twitter_conversion_tracking:
# Twitter Pixel ID
pixel_id:
# CDN provider settings
# https://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/speed-up-your-site-with-custom-cdn/
providers:
# Name or URL template of the JavaScript and/or stylesheet CDN provider
cdn: jsdelivr
# Name or URL template of the webfont CDN provider
fontcdn: google
# Name or URL of the fontawesome icon font CDN provider
iconcdn: fontawesome

89
hexo/_config.yml Normal file
View file

@ -0,0 +1,89 @@
title: developomp
subtitle: ''
description: developomp's website
keywords: developomp
author: developomp
language: en
timezone: ''
url: 'http://developomp.com'
root: /
permalink: ':title/'
permalink_defaults:
lang: en
pretty_urls:
trailing_index: false
trailing_html: false
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: ':lang'
skip_render:
- '*.json'
- '*.unityweb'
- '**/*.html'
- '*.xml'
- '*.js'
- '*.css'
- '*.txt'
feed:
type:
- atom
- rss2
path:
- atom.xml
- rss2.xml
limit: 10
hub: null
content: null
content_limit: 140
content_limit_delim: ' '
order_by: '-date'
icon: /img/icon_circle.svg
autodiscovery: true
template: null
new_post_name: ':title.md'
default_layout: post
titlecase: false
external_link:
enable: true
field: site
exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: true
line_number: true
auto_detect: false
tab_replace: ''
wrap: true
hljs: false
prismjs:
enable: false
preprocess: true
line_number: true
tab_replace: ''
index_generator:
path: ''
per_page: 10
order_by: '-date'
default_category: uncategorized
category_map: null
tag_map: null
meta_generator: true
date_format: YYYY-MM-DD
time_format: 'HH:mm:ss'
updated_option: mtime
per_page: 10
pagination_dir: page
include: null
exclude: null
ignore: null
theme: icarus
deploy:
type: ''

27
hexo/package.json Normal file
View file

@ -0,0 +1,27 @@
{
"name": "developomp.com",
"version": "0.0.0",
"private": true,
"author": "developomp",
"hexo": {
"version": "5.3.0"
},
"dependencies": {
"bulma-stylus": "^0.8.0",
"hexo": "latest",
"hexo-component-inferno": "latest",
"hexo-generator-archive": "latest",
"hexo-generator-category": "latest",
"hexo-generator-feed": "latest",
"hexo-generator-index": "latest",
"hexo-generator-tag": "latest",
"hexo-renderer-ejs": "latest",
"hexo-renderer-inferno": "latest",
"hexo-renderer-marked": "latest",
"hexo-renderer-stylus": "latest",
"hexo-server": "latest",
"hexo-theme-icarus": "latest",
"inferno": "latest",
"inferno-create-element": "latest"
}
}

6
hexo/scaffolds/post.md Normal file
View file

@ -0,0 +1,6 @@
---
title: { { title } }
date: { { date } }
updated: { { date } }
tags:
---

12
hexo/source/404.md Normal file
View file

@ -0,0 +1,12 @@
---
title:
comment:
licenses:
widgets:
article:
---
<center>
<h1><font size=40>404</font></h1>
the page you're looking for does not exist. :(
</center>

View file

@ -0,0 +1,9 @@
---
title: Quote NO.1
date: 2020-08-16
tags: quotes
---
> "Get the fuck out of my lawn"
<div style="text-align: right"> <i>- Mahatma Ghanghi (1885)</i> </div>

5
hexo/source/explore.md Normal file
View file

@ -0,0 +1,5 @@
---
title: explore
---
Nothing here.

2
hexo/source/feed.md Executable file
View file

@ -0,0 +1,2 @@
- [rss2](/rss2.xml)
- [atom](/atom.xml)

2
hexo/source/feeds.md Executable file
View file

@ -0,0 +1,2 @@
- [rss2](/rss2.xml)
- [atom](/atom.xml)

View file

@ -0,0 +1,7 @@
---
title: games
date: 2020-08-16
tags:
---
Nothing here yet.

View file

@ -0,0 +1,176 @@
/*---[ MAIN ]---*/
*, *::after, *::before {
box-sizing: border-box;
}
:root {
--cell-size: 100px;
--mark-size: calc(var(--cell-size) * .9);
--background-color: black;
--main-color: white;
}
body {
margin: 0;
background-color: var(--background-color);
}
/*---[ Winner message ]---*/
.winner {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, .9);
justify-content: center;
align-items: center;
color: var(--main-color);
font-size: 5rem;
font-family: Arial, sans-serif;
flex-direction: column;
}
.winner button {
font-size: 3rem;
background-color: var(--background-color);
color: var(--main-color);
border: 1px solid var(--main-color);
padding: .25em .5em;
cursor: pointer;
}
.winner button:hover {
background-color: var(--main-color);
color: var(--background-color);
border-color: var(--background-color);
}
.winner.show {
display: flex;
}
/*---[ Board styling ]---*/
.board {
width: 100vw;
height: 100vh;
display: grid;
justify-content: center;
align-content: center;
justify-items: center;
align-items: center;
grid-template-columns: repeat(3, auto);
}
/*---[ Cell styling ]---*/
.cell {
width: var(--cell-size);
height: var(--cell-size);
justify-content: center;
align-items: center;
display: flex;
background-color: var(--background-color);
border: 2px solid var(--main-color);
position: relative;
cursor: pointer;
}
.cell.x,
.cell.o {
cursor: not-allowed;
}
/*---[ Remove edge border for edge cells ]---*/
.cell:nth-child(1),
.cell:nth-child(2),
.cell:nth-child(3) {
border-top: none;
}
.cell:nth-child(1),
.cell:nth-child(4),
.cell:nth-child(7) {
border-left: none;
}
.cell:nth-child(3),
.cell:nth-child(6),
.cell:nth-child(9) {
border-right: none;
}
.cell:nth-child(7),
.cell:nth-child(8),
.cell:nth-child(9) {
border-bottom: none;
}
/*---[ X ]---*/
.cell.x::before,
.cell.x::after {
content: '';
position: absolute;
width: calc(var(--mark-size) * .1);
height: var(--mark-size);
background-color: var(--main-color);
}
.board.x .cell:not(.x):not(.o):hover::before,
.board.x .cell:not(.x):not(.o):hover::after {
content: '';
position: absolute;
width: calc(var(--mark-size) * .1);
height: var(--mark-size);
background-color: dimgray;
}
.cell.x::before,
.board.x .cell:hover::before {
transform: rotate(45deg);
}
.cell.x::after,
.board.x .cell:hover::after {
transform: rotate(-45deg);
}
/*---[ O ]---*/
.cell.o::before,
.cell.o::after {
content: '';
position: absolute;
border-radius: 50%;
width: var(--mark-size);
height: var(--mark-size);
background-color: var(--main-color);
}
.board.o .cell:not(.x):not(.o):hover::before,
.board.o .cell:not(.x):not(.o):hover::after {
content: '';
position: absolute;
border-radius: 50%;
width: var(--mark-size);
height: var(--mark-size);
background-color: dimgray;
}
.cell.o::before {
height: calc(var(--mark-size) * .9);
width: calc(var(--mark-size) * .9);
background-color: var(--main-color);
}
.board.o .cell:not(.x):not(.o):hover::before {
height: calc(var(--mark-size) * .9);
width: calc(var(--mark-size) * .9);
background-color: dimgray;
}
.cell.o::after,
.board.o .cell:not(.x):not(.o):hover::after{
height: calc(var(--mark-size) * .69);
width: calc(var(--mark-size) *.69);
background-color: var(--background-color);
}

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TicTac Toe</title>
<link rel="stylesheet" href="/games/tictactoe/index.css">
<script src="/games/tictactoe/index.js" defer></script>
</head>
<body>
<div class="board x" id="board">
<div class="cell" data-cell></div>
<div class="cell" data-cell></div>
<div class="cell" data-cell></div>
<div class="cell" data-cell></div>
<div class="cell" data-cell></div>
<div class="cell" data-cell></div>
<div class="cell" data-cell></div>
<div class="cell" data-cell></div>
<div class="cell" data-cell></div>
</div>
<div class="winner" id="winner">
<div data-message></div>
<button id="restart">Restart</button>
</div>
</body>
</html>

View file

@ -0,0 +1,89 @@
const X_CLASS = "x"
const O_CLASS = "o"
const WINNING_PATTERN = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
]
const cellElements = document.querySelectorAll("[data-cell]")
const board = document.getElementById("board")
const winnerMessage = document.querySelector("[data-message]")
const winner = document.getElementById("winner")
const restartButton = document.getElementById("restart")
let oTurn = false;
restartButton.addEventListener("click", gameStart)
function gameStart() {
function clickHandler(event) {
console.log(full())
const currentClass = oTurn ? O_CLASS : X_CLASS
event.target.classList.add(currentClass) // add O or X to the grid
if (checkWin(currentClass)) {
gameOver(false)
} else if (full()) {
gameOver(true)
}
oTurn = !oTurn // change tern
updateHover()
}
winner.classList.remove("show")
cellElements.forEach(cell => {
cell.classList.remove("o")
cell.classList.remove("x")
})
cellElements.forEach(cell => {
cell.addEventListener("click", clickHandler, {once: true})
})
updateHover()
}
function gameOver(draw) {
if (draw) {
// show draw message
}
else {
winnerMessage.innerText = `${oTurn ? "O" : "X"} won!!`
}
winner.classList.add("show")
}
function updateHover() {
board.classList.remove(X_CLASS)
board.classList.remove(O_CLASS)
if (oTurn) {
board.classList.add(O_CLASS)
}
else {
board.classList.add(X_CLASS)
}
}
function checkWin(currentClass) {
return WINNING_PATTERN.some(combination => {
return combination.every(index => {
return cellElements[index].classList.contains(currentClass)
})
})
}
function full() {
//todo: add when the game is a draw
return false
}
gameStart()

BIN
hexo/source/img/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

4
hexo/source/img/icon.svg Normal file
View file

@ -0,0 +1,4 @@
<svg width="800" height="800" viewBox="0 0 800 800" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="800" height="800" fill="black"/>
<path d="M217.617 226.262H184.863C180.632 226.262 176.23 226.77 171.66 227.785C167.259 228.632 163.197 230.07 159.473 232.102C155.749 234.133 152.702 236.757 150.332 239.973C147.962 243.189 146.777 247.082 146.777 251.652V252.16V341.281C146.777 354.315 144.915 365.826 141.191 375.812C137.467 385.63 132.643 394.178 126.719 401.457C133.828 410.598 138.822 420.415 141.699 430.91C144.746 441.405 146.27 451.223 146.27 460.363V550.246C146.27 556.171 147.793 560.91 150.84 564.465C153.887 567.85 157.526 570.474 161.758 572.336C165.99 574.029 170.221 575.129 174.453 575.637C178.685 575.975 181.986 576.145 184.355 576.145H217.109V642.922H183.848C176.908 642.922 169.46 642.16 161.504 640.637C153.717 639.283 145.931 636.997 138.145 633.781C130.527 630.734 123.164 626.757 116.055 621.848C109.115 616.939 102.936 611.014 97.5195 604.074C92.2721 597.134 88.0404 589.178 84.8242 580.207C81.7773 571.236 80.2539 561.079 80.2539 549.738V460.871C80.2539 451.9 77.8841 445.214 73.1445 440.812C68.5742 436.411 62.1419 434.211 53.8477 434.211C49.1081 434.211 44.707 433.365 40.6445 431.672C36.582 429.81 33.0273 427.44 29.9805 424.562C27.1029 421.516 24.8177 417.961 23.125 413.898C21.4323 409.836 20.5859 405.52 20.5859 400.949C20.5859 396.379 21.4323 392.147 23.125 388.254C24.8177 384.191 27.1029 380.721 29.9805 377.844C33.0273 374.797 36.4974 372.427 40.3906 370.734C44.4531 368.872 48.7695 367.857 53.3398 367.688C62.4805 367.688 69.3359 365.487 73.9062 361.086C78.4766 356.516 80.7617 349.914 80.7617 341.281V251.652C80.7617 237.095 83.724 224.146 89.6484 212.805C95.5729 201.464 103.444 191.9 113.262 184.113C123.079 176.327 134.167 170.402 146.523 166.34C159.049 162.277 171.829 160.246 184.863 160.246H217.617V226.262ZM595.47 371.242C595.47 386.307 593.608 399.764 589.884 411.613C586.16 423.462 581.082 433.957 574.65 443.098C568.387 452.069 561.108 459.771 552.814 466.203C544.52 472.635 535.802 477.883 526.662 481.945C517.69 486.008 508.55 488.97 499.24 490.832C490.099 492.694 481.466 493.625 473.341 493.625H324.045V427.609H473.341C481.805 426.932 489.422 425.24 496.193 422.531C503.133 419.654 509.058 415.845 513.966 411.105C518.875 406.366 522.684 400.695 525.392 394.094C528.101 387.323 529.455 379.706 529.455 371.242V341.281C528.608 332.987 526.831 325.37 524.123 318.43C521.414 311.49 517.69 305.565 512.951 300.656C508.38 295.747 502.795 291.939 496.193 289.23C489.591 286.353 481.974 284.914 473.341 284.914H324.552C315.75 284.914 309.064 287.199 304.494 291.77C299.923 296.34 297.638 302.941 297.638 311.574V583H231.623V311.574C231.623 294.647 234.67 280.259 240.763 268.41C247.026 256.561 254.728 246.997 263.869 239.719C273.179 232.44 283.25 227.193 294.084 223.977C304.917 220.591 314.904 218.898 324.045 218.898H473.341C488.237 218.898 501.61 220.845 513.459 224.738C525.308 228.462 535.718 233.54 544.689 239.973C553.83 246.236 561.532 253.514 567.795 261.809C574.227 270.103 579.474 278.82 583.537 287.961C587.768 296.932 590.815 306.073 592.677 315.383C594.539 324.523 595.47 333.156 595.47 341.281V371.242ZM778.07 400.949C778.07 405.52 777.223 409.836 775.53 413.898C773.838 417.961 771.468 421.516 768.421 424.562C765.543 427.44 762.073 429.81 758.011 431.672C754.118 433.365 749.886 434.211 745.316 434.211C736.683 434.211 729.997 436.411 725.257 440.812C720.687 445.214 718.402 451.9 718.402 460.871L718.909 549.738C718.909 561.079 717.301 571.236 714.085 580.207C710.869 589.178 706.553 597.134 701.136 604.074C695.719 611.014 689.456 616.939 682.347 621.848C675.407 626.757 668.043 630.734 660.257 633.781C652.64 636.997 644.853 639.283 636.898 640.637C629.111 642.16 621.748 642.922 614.808 642.922H582.054L581.546 576.145H614.808C617.008 576.145 620.224 575.975 624.456 575.637C628.688 575.129 632.835 574.029 636.898 572.336C641.129 570.474 644.769 567.85 647.816 564.465C650.862 560.91 652.386 556.171 652.386 550.246V460.363C652.386 451.223 653.909 441.405 656.956 430.91C660.172 420.415 665.166 410.598 671.937 401.457C666.012 394.178 661.103 385.63 657.21 375.812C653.486 365.826 651.624 354.315 651.624 341.281V252.16V251.652C650.778 246.913 649.17 242.935 646.8 239.719C644.599 236.503 641.806 233.879 638.421 231.848C635.036 229.816 631.227 228.378 626.995 227.531C622.933 226.685 618.701 226.262 614.3 226.262H581.038V160.246H614.3C628.011 160.246 641.129 162.447 653.655 166.848C666.181 171.079 677.184 177.258 686.663 185.383C696.312 193.339 703.929 202.987 709.515 214.328C715.101 225.5 717.894 237.941 717.894 251.652C717.894 252.837 717.978 260.878 718.148 275.773C718.317 290.5 718.402 312.336 718.402 341.281C718.402 349.914 720.602 356.516 725.003 361.086C729.404 365.487 736.175 367.688 745.316 367.688C749.886 367.857 754.118 368.872 758.011 370.734C762.073 372.427 765.543 374.797 768.421 377.844C771.468 380.721 773.838 384.191 775.53 388.254C777.223 392.147 778.07 396.379 778.07 400.949Z" fill="#F4F4F4"/>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

View file

@ -0,0 +1,4 @@
<svg width="800" height="800" viewBox="0 0 800 800" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="400" cy="400" r="400" fill="black"/>
<path d="M217.617 226.262H184.863C180.632 226.262 176.23 226.77 171.66 227.785C167.259 228.632 163.197 230.07 159.473 232.102C155.749 234.133 152.702 236.757 150.332 239.973C147.962 243.189 146.777 247.082 146.777 251.652V252.16V341.281C146.777 354.315 144.915 365.826 141.191 375.812C137.467 385.63 132.643 394.178 126.719 401.457C133.828 410.598 138.822 420.415 141.699 430.91C144.746 441.405 146.27 451.223 146.27 460.363V550.246C146.27 556.171 147.793 560.91 150.84 564.465C153.887 567.85 157.526 570.474 161.758 572.336C165.99 574.029 170.221 575.129 174.453 575.637C178.685 575.975 181.986 576.145 184.355 576.145H217.109V642.922H183.848C176.908 642.922 169.46 642.16 161.504 640.637C153.717 639.283 145.931 636.997 138.145 633.781C130.527 630.734 123.164 626.757 116.055 621.848C109.115 616.939 102.936 611.014 97.5195 604.074C92.2721 597.134 88.0404 589.178 84.8242 580.207C81.7773 571.236 80.2539 561.079 80.2539 549.738V460.871C80.2539 451.9 77.8841 445.214 73.1445 440.812C68.5742 436.411 62.1419 434.211 53.8477 434.211C49.1081 434.211 44.707 433.365 40.6445 431.672C36.582 429.81 33.0273 427.44 29.9805 424.562C27.1029 421.516 24.8177 417.961 23.125 413.898C21.4323 409.836 20.5859 405.52 20.5859 400.949C20.5859 396.379 21.4323 392.147 23.125 388.254C24.8177 384.191 27.1029 380.721 29.9805 377.844C33.0273 374.797 36.4974 372.427 40.3906 370.734C44.4531 368.872 48.7695 367.857 53.3398 367.688C62.4805 367.688 69.3359 365.487 73.9062 361.086C78.4766 356.516 80.7617 349.914 80.7617 341.281V251.652C80.7617 237.095 83.724 224.146 89.6484 212.805C95.5729 201.464 103.444 191.9 113.262 184.113C123.079 176.327 134.167 170.402 146.523 166.34C159.049 162.277 171.829 160.246 184.863 160.246H217.617V226.262ZM595.47 371.242C595.47 386.307 593.608 399.764 589.884 411.613C586.16 423.462 581.082 433.957 574.65 443.098C568.387 452.069 561.108 459.771 552.814 466.203C544.52 472.635 535.802 477.883 526.662 481.945C517.69 486.008 508.55 488.97 499.24 490.832C490.099 492.694 481.466 493.625 473.341 493.625H324.045V427.609H473.341C481.805 426.932 489.422 425.24 496.193 422.531C503.133 419.654 509.058 415.845 513.966 411.105C518.875 406.366 522.684 400.695 525.392 394.094C528.101 387.323 529.455 379.706 529.455 371.242V341.281C528.608 332.987 526.831 325.37 524.123 318.43C521.414 311.49 517.69 305.565 512.951 300.656C508.38 295.747 502.795 291.939 496.193 289.23C489.591 286.353 481.974 284.914 473.341 284.914H324.552C315.75 284.914 309.064 287.199 304.494 291.77C299.923 296.34 297.638 302.941 297.638 311.574V583H231.623V311.574C231.623 294.647 234.67 280.259 240.763 268.41C247.026 256.561 254.728 246.997 263.869 239.719C273.179 232.44 283.25 227.193 294.084 223.977C304.917 220.591 314.904 218.898 324.045 218.898H473.341C488.237 218.898 501.61 220.845 513.459 224.738C525.308 228.462 535.718 233.54 544.689 239.973C553.83 246.236 561.532 253.514 567.795 261.809C574.227 270.103 579.474 278.82 583.537 287.961C587.768 296.932 590.815 306.073 592.677 315.383C594.539 324.523 595.47 333.156 595.47 341.281V371.242ZM778.07 400.949C778.07 405.52 777.223 409.836 775.53 413.898C773.838 417.961 771.468 421.516 768.421 424.562C765.543 427.44 762.073 429.81 758.011 431.672C754.118 433.365 749.886 434.211 745.316 434.211C736.683 434.211 729.997 436.411 725.257 440.812C720.687 445.214 718.402 451.9 718.402 460.871L718.909 549.738C718.909 561.079 717.301 571.236 714.085 580.207C710.869 589.178 706.553 597.134 701.136 604.074C695.719 611.014 689.456 616.939 682.347 621.848C675.407 626.757 668.043 630.734 660.257 633.781C652.64 636.997 644.853 639.283 636.898 640.637C629.111 642.16 621.748 642.922 614.808 642.922H582.054L581.546 576.145H614.808C617.008 576.145 620.224 575.975 624.456 575.637C628.688 575.129 632.835 574.029 636.898 572.336C641.129 570.474 644.769 567.85 647.816 564.465C650.862 560.91 652.386 556.171 652.386 550.246V460.363C652.386 451.223 653.909 441.405 656.956 430.91C660.172 420.415 665.166 410.598 671.937 401.457C666.012 394.178 661.103 385.63 657.21 375.812C653.486 365.826 651.624 354.315 651.624 341.281V252.16V251.652C650.778 246.913 649.17 242.935 646.8 239.719C644.599 236.503 641.806 233.879 638.421 231.848C635.036 229.816 631.227 228.378 626.995 227.531C622.933 226.685 618.701 226.262 614.3 226.262H581.038V160.246H614.3C628.011 160.246 641.129 162.447 653.655 166.848C666.181 171.079 677.184 177.258 686.663 185.383C696.312 193.339 703.929 202.987 709.515 214.328C715.101 225.5 717.894 237.941 717.894 251.652C717.894 252.837 717.978 260.878 718.148 275.773C718.317 290.5 718.402 312.336 718.402 341.281C718.402 349.914 720.602 356.516 725.003 361.086C729.404 365.487 736.175 367.688 745.316 367.688C749.886 367.857 754.118 368.872 758.011 370.734C762.073 372.427 765.543 374.797 768.421 377.844C771.468 380.721 773.838 384.191 775.53 388.254C777.223 392.147 778.07 396.379 778.07 400.949Z" fill="#F4F4F4"/>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -0,0 +1,3 @@
<svg width="800" height="800" viewBox="0 0 800 800" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M217.617 226.262H184.863C180.632 226.262 176.23 226.77 171.66 227.785C167.259 228.632 163.197 230.07 159.473 232.102C155.749 234.133 152.702 236.757 150.332 239.973C147.962 243.189 146.777 247.082 146.777 251.652V252.16V341.281C146.777 354.315 144.915 365.826 141.191 375.812C137.467 385.63 132.643 394.178 126.719 401.457C133.828 410.598 138.822 420.415 141.699 430.91C144.746 441.405 146.27 451.223 146.27 460.363V550.246C146.27 556.171 147.793 560.91 150.84 564.465C153.887 567.85 157.526 570.474 161.758 572.336C165.99 574.029 170.221 575.129 174.453 575.637C178.685 575.975 181.986 576.145 184.355 576.145H217.109V642.922H183.848C176.908 642.922 169.46 642.16 161.504 640.637C153.717 639.283 145.931 636.997 138.145 633.781C130.527 630.734 123.164 626.757 116.055 621.848C109.115 616.939 102.936 611.014 97.5195 604.074C92.2721 597.134 88.0404 589.178 84.8242 580.207C81.7773 571.236 80.2539 561.079 80.2539 549.738V460.871C80.2539 451.9 77.8841 445.214 73.1445 440.812C68.5742 436.411 62.1419 434.211 53.8477 434.211C49.1081 434.211 44.707 433.365 40.6445 431.672C36.582 429.81 33.0273 427.44 29.9805 424.562C27.1029 421.516 24.8177 417.961 23.125 413.898C21.4323 409.836 20.5859 405.52 20.5859 400.949C20.5859 396.379 21.4323 392.147 23.125 388.254C24.8177 384.191 27.1029 380.721 29.9805 377.844C33.0273 374.797 36.4974 372.427 40.3906 370.734C44.4531 368.872 48.7695 367.857 53.3398 367.688C62.4805 367.688 69.3359 365.487 73.9062 361.086C78.4766 356.516 80.7617 349.914 80.7617 341.281V251.652C80.7617 237.095 83.724 224.146 89.6484 212.805C95.5729 201.464 103.444 191.9 113.262 184.113C123.079 176.327 134.167 170.402 146.523 166.34C159.049 162.277 171.829 160.246 184.863 160.246H217.617V226.262ZM595.47 371.242C595.47 386.307 593.608 399.764 589.884 411.613C586.16 423.462 581.082 433.957 574.65 443.098C568.387 452.069 561.108 459.771 552.814 466.203C544.52 472.635 535.802 477.883 526.662 481.945C517.69 486.008 508.55 488.97 499.24 490.832C490.099 492.694 481.466 493.625 473.341 493.625H324.045V427.609H473.341C481.805 426.932 489.422 425.24 496.193 422.531C503.133 419.654 509.058 415.845 513.966 411.105C518.875 406.366 522.684 400.695 525.392 394.094C528.101 387.323 529.455 379.706 529.455 371.242V341.281C528.608 332.987 526.831 325.37 524.123 318.43C521.414 311.49 517.69 305.565 512.951 300.656C508.38 295.747 502.795 291.939 496.193 289.23C489.591 286.353 481.974 284.914 473.341 284.914H324.552C315.75 284.914 309.064 287.199 304.494 291.77C299.923 296.34 297.638 302.941 297.638 311.574V583H231.623V311.574C231.623 294.647 234.67 280.259 240.763 268.41C247.026 256.561 254.728 246.997 263.869 239.719C273.179 232.44 283.25 227.193 294.084 223.977C304.917 220.591 314.904 218.898 324.045 218.898H473.341C488.237 218.898 501.61 220.845 513.459 224.738C525.308 228.462 535.718 233.54 544.689 239.973C553.83 246.236 561.532 253.514 567.795 261.809C574.227 270.103 579.474 278.82 583.537 287.961C587.768 296.932 590.815 306.073 592.677 315.383C594.539 324.523 595.47 333.156 595.47 341.281V371.242ZM778.07 400.949C778.07 405.52 777.223 409.836 775.53 413.898C773.838 417.961 771.468 421.516 768.421 424.562C765.543 427.44 762.073 429.81 758.011 431.672C754.118 433.365 749.886 434.211 745.316 434.211C736.683 434.211 729.997 436.411 725.257 440.812C720.687 445.214 718.402 451.9 718.402 460.871L718.909 549.738C718.909 561.079 717.301 571.236 714.085 580.207C710.869 589.178 706.553 597.134 701.136 604.074C695.719 611.014 689.456 616.939 682.347 621.848C675.407 626.757 668.043 630.734 660.257 633.781C652.64 636.997 644.853 639.283 636.898 640.637C629.111 642.16 621.748 642.922 614.808 642.922H582.054L581.546 576.145H614.808C617.008 576.145 620.224 575.975 624.456 575.637C628.688 575.129 632.835 574.029 636.898 572.336C641.129 570.474 644.769 567.85 647.816 564.465C650.862 560.91 652.386 556.171 652.386 550.246V460.363C652.386 451.223 653.909 441.405 656.956 430.91C660.172 420.415 665.166 410.598 671.937 401.457C666.012 394.178 661.103 385.63 657.21 375.812C653.486 365.826 651.624 354.315 651.624 341.281V252.16V251.652C650.778 246.913 649.17 242.935 646.8 239.719C644.599 236.503 641.806 233.879 638.421 231.848C635.036 229.816 631.227 228.378 626.995 227.531C622.933 226.685 618.701 226.262 614.3 226.262H581.038V160.246H614.3C628.011 160.246 641.129 162.447 653.655 166.848C666.181 171.079 677.184 177.258 686.663 185.383C696.312 193.339 703.929 202.987 709.515 214.328C715.101 225.5 717.894 237.941 717.894 251.652C717.894 252.837 717.978 260.878 718.148 275.773C718.317 290.5 718.402 312.336 718.402 341.281C718.402 349.914 720.602 356.516 725.003 361.086C729.404 365.487 736.175 367.688 745.316 367.688C749.886 367.857 754.118 368.872 758.011 370.734C762.073 372.427 765.543 374.797 768.421 377.844C771.468 380.721 773.838 384.191 775.53 388.254C777.223 392.147 778.07 396.379 778.07 400.949Z" fill="#F4F4F4"/>
</svg>

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -0,0 +1,166 @@
/**
* @author mrdoob / http://mrdoob.com/
* @author Mugen87 / https://github.com/Mugen87
*/
// https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/jsm/controls/PointerLockControls.js
import {
Euler,
EventDispatcher,
Vector3
} from "./three.js";
var PointerLockControls = function ( camera, domElement ) {
if ( domElement === undefined ) {
console.warn( 'THREE.PointerLockControls: The second parameter "domElement" is now mandatory.' );
domElement = document.body;
}
this.domElement = domElement;
this.isLocked = false;
//
// internals
//
var scope = this;
var changeEvent = { type: 'change' };
var lockEvent = { type: 'lock' };
var unlockEvent = { type: 'unlock' };
var euler = new Euler( 0, 0, 0, 'YXZ' );
var PI_2 = Math.PI / 2;
var vec = new Vector3();
function onMouseMove( event ) {
if ( scope.isLocked === false ) return;
var movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;
var movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;
euler.setFromQuaternion( camera.quaternion );
euler.y -= movementX * 0.002;
euler.x -= movementY * 0.002;
euler.x = Math.max( - PI_2, Math.min( PI_2, euler.x ) );
camera.quaternion.setFromEuler( euler );
scope.dispatchEvent( changeEvent );
}
function onPointerlockChange() {
if ( document.pointerLockElement === scope.domElement ) {
scope.dispatchEvent( lockEvent );
scope.isLocked = true;
} else {
scope.dispatchEvent( unlockEvent );
scope.isLocked = false;
}
}
function onPointerlockError() {
console.error( 'THREE.PointerLockControls: Unable to use Pointer Lock API' );
}
this.connect = function () {
document.addEventListener( 'mousemove', onMouseMove, false );
document.addEventListener( 'pointerlockchange', onPointerlockChange, false );
document.addEventListener( 'pointerlockerror', onPointerlockError, false );
};
this.disconnect = function () {
document.removeEventListener( 'mousemove', onMouseMove, false );
document.removeEventListener( 'pointerlockchange', onPointerlockChange, false );
document.removeEventListener( 'pointerlockerror', onPointerlockError, false );
};
this.dispose = function () {
this.disconnect();
};
this.getObject = function () { // retaining this method for backward compatibility
return camera;
};
this.getDirection = function () {
var direction = new Vector3( 0, 0, - 1 );
return function ( v ) {
return v.copy( direction ).applyQuaternion( camera.quaternion );
};
}();
this.moveForward = function ( distance ) {
// move forward parallel to the xz-plane
// assumes camera.up is y-up
vec.setFromMatrixColumn( camera.matrix, 0 );
vec.crossVectors( camera.up, vec );
camera.position.addScaledVector( vec, distance );
};
this.moveRight = function ( distance ) {
vec.setFromMatrixColumn( camera.matrix, 0 );
camera.position.addScaledVector( vec, distance );
};
this.lock = function () {
this.domElement.requestPointerLock();
};
this.unlock = function () {
document.exitPointerLock();
};
this.connect();
};
PointerLockControls.prototype = Object.create( EventDispatcher.prototype );
PointerLockControls.prototype.constructor = PointerLockControls;
export { PointerLockControls };

View file

@ -0,0 +1,89 @@
body {
margin: 0;
background-color: #282828;
color: #fff;
font-family: Monospace, sans-serif;
font-size: 13px;
line-height: 24px;
overscroll-behavior: none;
}
canvas {
width: 100%;
height: 100%;
display: block;
}
a {
color: #ff0;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
button {
cursor: pointer;
text-transform: uppercase;
}
#info {
position: absolute;
top: 0;
width: 100%;
padding: 10px;
box-sizing: border-box;
text-align: center;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
z-index: 1;
}
a, button, input, select {
pointer-events: auto;
}
.dg.ac {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
z-index: 2 !important;
}
#overlay {
position: absolute;
z-index: 2;
top: 0;
left: 0;
width: 100%;
height:100%;
display: flex;
align-items: center;
justify-content: center;
opacity: 1;
background-color: #000000;
color: #ffffff;
}
#overlay > div {
text-align: center;
}
#overlay > div > button {
height: 20px;
background: transparent;
color: #ffffff;
outline: 1px solid #ffffff;
border: 0;
cursor: pointer;
}
#overlay > div > p {
color: #777777;
font-size: 12px;
}

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>3D</title>
<link rel="stylesheet" href="/games/3d/index.css">
<script src="/games/3d/index.js" defer></script>
<script src="/games/3d/three.js"></script>
</head>
<body>
<div id="3dView"></div>
</body>
</html>

View file

@ -0,0 +1,122 @@
// https://cdnjs.cloudflare.com/ajax/libs/three.js/104/three.js
// https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.2/TweenMax.min.js
let scene, camera, container, GL_Renderer
let materials = {}, lights = {}, objects = {}
let FOV = 75
/*---[ HELPERS ]---*/
function moveObject(object, x, y, z) {
object.position.x += x
object.position.y += y
object.position.z += z
}
function rotateObject(object, x, y, z) {
object.rotateX(x)
object.rotateY(y)
object.rotateZ(z)
}
function setScale(object, scale) {
object.scale.x = object.scale.y = object.scale.z = scale
}
/*---[ EVENTS ]---*/
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight
camera.updateProjectionMatrix()
GL_Renderer.setSize(window.innerWidth, window.innerHeight)
}
function Start() {
window.addEventListener("resize", onWindowResize, false)
container = document.getElementById("3dView")
// Scene
{
scene = new THREE.Scene()
scene.background = new THREE.Color(0x000000)
scene.fog = new THREE.Fog(0xffffff, 0, 750)
}
// Camera
{
camera = new THREE.PerspectiveCamera(FOV, window.innerWidth / window.innerHeight, 0.1, 10000)
moveObject(camera, 0, 0, 500)
scene.add(camera)
}
// Lights
{
lights.ambientLight = new THREE.AmbientLight(0x404040, 0.3)
moveObject(lights.ambientLight, 10, 10, 10)
scene.add(lights.ambientLight)
lights.one = new THREE.DirectionalLight(0x00ffff, 0.3)
lights.one.position = camera.position
scene.add(lights.one)
lights.mainLight = new THREE.DirectionalLight(0xaabbff, 0.7)
moveObject(lights.mainLight, 0, 10, 20)
scene.add(lights.mainLight)
}
// Material
{
materials.main = new THREE.MeshPhongMaterial({
color: 0xffffff,
shading: THREE.FlatShading
})
materials.wire = new THREE.MeshPhongMaterial({
color: 0xffffff,
side: THREE.DoubleSide,
wireframe: true
})
}
// Objects
{
objects.rotatingGeo = {}
objects.rotatingGeo.main = new THREE.Mesh(new THREE.IcosahedronGeometry(8, 1), materials.main)
setScale(objects.rotatingGeo.main, 15)
scene.add(objects.rotatingGeo.main)
let outerGeo = new THREE.IcosahedronBufferGeometry(15, 1)
objects.rotatingGeo.outer = new THREE.Mesh(outerGeo, materials.wire)
setScale(objects.rotatingGeo.outer, 10)
scene.add(objects.rotatingGeo.outer)
let vertices = outerGeo.attributes.position.array;
for (let k=0; k<vertices.length; k+=3) {
let vertexSphere = new THREE.Mesh(new THREE.SphereGeometry(0.3, 5, 5), materials.main);
vertexSphere.applyMatrix(new THREE.Matrix4().makeTranslation(vertices[k],vertices[k+1],vertices[k+2]));
objects.rotatingGeo.outer.add(vertexSphere);
}
}
// Renderer
{
GL_Renderer = new THREE.WebGLRenderer({antialias: true, alpha: true })
GL_Renderer.setPixelRatio((window.devicePixelRatio) ? window.devicePixelRatio : 1)
GL_Renderer.setSize(window.innerWidth, window.innerHeight)
GL_Renderer.autoClear = false
GL_Renderer.setClearColor(0x000000, 0.0)
container.appendChild(GL_Renderer.domElement)
}
}
function Update() {
requestAnimationFrame(Update)
rotateObject(objects.rotatingGeo.main, 0.002, 0.003, 0)
rotateObject(objects.rotatingGeo.outer, 0.001, 0.003, 0)
GL_Renderer.render(scene, camera)
}
window.onload = () => {
Start()
Update()
}

File diff suppressed because one or more lines are too long

3
hexo/source/robots.txt Executable file
View file

@ -0,0 +1,3 @@
User-agent: *
Allow: /
Sitemap: /sitemap.xml