Skip to content

Commit

Permalink
updated webpack
Browse files Browse the repository at this point in the history
added quality options
updated options
  • Loading branch information
Tuqire Hussain committed Jun 23, 2019
1 parent 37276ac commit 304cc3a
Show file tree
Hide file tree
Showing 15 changed files with 2,830 additions and 2,711 deletions.
6 changes: 3 additions & 3 deletions .babelrc
@@ -1,8 +1,8 @@
{
"plugins": ["transform-object-rest-spread"],
"presets": [
["env", {
"modules": false
["@babel/preset-env", {
"modules": false,
"targets": "> 0.25%, not dead"
}]
]
}
21 changes: 8 additions & 13 deletions README.md
@@ -1,26 +1,21 @@
# WEBGL Webcam Outline
# Webcam Outline

This project converts your webcam fed into a comic like visual. Built using `THREE.js`, and `GPGPU`.
This project manipulates a particle system using your webcam. Built using `Javascript`, `THREE.js`, and [`GPGPU`](https://en.wikipedia.org/wiki/General-purpose_computing_on_graphics_processing_units).

## Run locally
Requires access to your webcam.

## To run locally

```bash
yarn start
yarn && yarn start
```

Then visit [http://localhost:8091](http://localhost:8091)
Then visit http://localhost:8091

## Working Demo

[https://tuqire.github.io/webcam-outline/](https://tuqire.github.io/webcam-outline/)
[tuqire.github.io/webcam-outline/](https://tuqire.github.io/webcam-outline/)

## Contributers

* Tuqire Hussain <me@tuqire.com>

## TODO

1. adjust image diff map
2. remove excess params in size simulation shader
3. add low and high val to particles and uniforms
4. move image map to shader
44 changes: 23 additions & 21 deletions package.json
@@ -1,35 +1,35 @@
{
"name": "webcam-mosaic",
"version": "1.0.0",
"description": "Tuqire Hussain's Webcam Mosaic project",
"main": "src/js/main.js",
"author": "Tuqire hussain <me@tuqire.com> (http://www.tuqire.com)",
"name": "webcam-outline",
"version": "2.0.0",
"description": "Webcam Outline",
"main": "src/js/index.js",
"author": "Tuqire Hussain <me@tuqire.com> (http://www.tuqire.com)",
"license": "MIT",
"bugs": {
"url": "https://github.com/tuqire/webcam-mosaic/issues"
"url": "https://github.com/tuqire/webcam-outline/issues"
},
"homepage": "https://github.com/tuqire/webcam-mosaic#readme",
"homepage": "https://github.com/tuqire/webcam-outline#readme",
"scripts": {
"build": "NODE_ENV='production' webpack",
"build:github": "NODE_ENV='production' GITHUB='true' webpack",
"build": "NODE_ENV=production webpack",
"build:github": "NODE_ENV=production GITHUB=true webpack",
"lint": "eslint src && eslint webpack.config.js",
"start": "webpack-dev-server"
},
"dependencies": {
"dat-gui": "^0.5.0",
"detector-webgl": "^2.0.0",
"js-media-queries": "^1.1.0",
"stats.js": "^0.17.0",
"three": "^0.85.0",
"three": "^0.84.0",
"three-trackballcontrols": "0.0.5",
"three.js-fbo": "^1.5.0"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-loader": "^6.2.10",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^4.5.1",
"eslint": "^4.18.2",
"eslint-config-standard": "^10.2.1",
Expand All @@ -39,10 +39,12 @@
"eslint-plugin-node": "^6.0.0",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"handlebars-webpack-plugin": "^1.4.1",
"json-loader": "^0.5.7",
"html-webpack-plugin": "^3.2.0",
"json-loader": "^0.5.4",
"path": "^0.12.7",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.6.1"
"uglifyjs-webpack-plugin": "^2.1.3",
"webpack": "^4.35.0",
"webpack-cli": "^3.3.5",
"webpack-dev-server": "^3.7.2"
}
}
13 changes: 0 additions & 13 deletions src/hbs/data/main.json

This file was deleted.

62 changes: 0 additions & 62 deletions src/hbs/index.hbs

This file was deleted.

13 changes: 0 additions & 13 deletions src/hbs/partials/head.hbs

This file was deleted.

137 changes: 137 additions & 0 deletions src/html/index.html
@@ -0,0 +1,137 @@
<!doctype html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title>Webcam Outline - By Tuqire Hussain</title>
<style>
body {
color: rgb(238, 238, 238);
background-color: #000000;
height: 100vh;
margin: 0px;
overflow: hidden;
font-family: Arial, sans-serif;
font-size: 12px;
line-height: 1.7;
}

* {
box-sizing: border-box;
}

a {
color: inherit;
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

#container {
width: 100%;
height: 100%;
position: relative;
}

#select-quality {
display: none;
font-size: 15px;
position: relative;
top: 50%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
text-align: center;
}

.quality-selector {
cursor: pointer;
background: none;
color: inherit;
text-decoration: none;
font-size: 15px;
padding: 10px;
margin: 0 10px;
border: 1px solid white;
}

.quality-selector:hover {
background: #333;
}

h4 {
font-size: 25px;
margin: 0 20px 30px;
}

#no-support {
display: none;
position: relative;
top: 50%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
text-align: center;
}

#info {
display: none;
line-height: 2;
background-color: rgb(26, 26, 26);
position: absolute;
bottom: 0px;
box-sizing: border-box;
}

.info-content {
padding: 15px;
}

.hide-info-button {
display: block;
cursor: pointer;
background-color: rgb(20, 20, 20);
padding: 5px 10px;
position: absolute;
width: 100%;
min-width: 80px;
left: 0;
top: -30px;
}
</style>
<meta property="og:url" content="https://tuqire.github.com/webcam-outline/" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Webcam Outline" />
<meta property="og:description" content="A particles simulation driven by Webcam" />
<meta property="og:image" content="https://tuqire.github.com/webcam-outline/images/fb-share.jpg" />
</head>
<body>
<div id="container">
<div id="simulation"></div>
<div id="select-quality">
<h4>Select Quality</h4>
<a class="quality-selector" href="?quality=50000">Very Low</a>
<a class="quality-selector" href="?quality=75000">Low</a>
<a class="quality-selector" href="?quality=100000">Medium</a>
<a class="quality-selector" href="?quality=150000">High</a>
<a class="quality-selector" href="?quality=250000">Very High</a>
</div>
<div id="no-support">
<h4>Your device or browser is not supported. Please use the latest version of Chrome on desktop.</h4>
</div>
<div id="info">
<a class="hide-info-button">Close</a>
<div class="info-content">
Number of particles: <span class="num-particles">0</span><br>
By <a target="_blank" href="http://www.tuqire.com">Tuqire Hussain</a>
[<a target="_blank" href="https://github.com/tuqire/webcam-outline">View Code</a>]<br>
Select Quality:
<a href="?quality=50000">V Low</a> |
<a href="?quality=75000">Low</a> |
<a href="?quality=100000">Medium</a> |
<a href="?quality=150000">High</a> |
<a href="?quality=250000">V High</a>
</div>
</div>
</div>
</body>
16 changes: 16 additions & 0 deletions src/js/helpers/getParameterByName.js
@@ -0,0 +1,16 @@
const getParameterByName = (name, url) => {
if (!url) {
url = window.location.href
}

name = name.replace(/[[\]]/g, '\\$&')
const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`)
const results = regex.exec(url)

if (!results) return null
if (!results[2]) return ''

return decodeURIComponent(results[2].replace(/\+/g, ' '))
}

export default getParameterByName
1 change: 1 addition & 0 deletions src/js/helpers/isNotMobileScreen.js
@@ -0,0 +1 @@
export default () => window.matchMedia('(min-width: 480px)').matches
20 changes: 20 additions & 0 deletions src/js/helpers/showInfoBox.js
@@ -0,0 +1,20 @@
import getParameterByName from './getParameterByName'

export default () => {
const infoContent = document.querySelector('.info-content')
const infoHider = document.querySelector('.hide-info-button')
const quality = Number(getParameterByName('quality'))

document.getElementById('info').style.display = 'inline'
document.querySelector('.num-particles').innerHTML = quality.toLocaleString()

infoHider.addEventListener('click', () => {
if (infoHider.innerHTML === 'Close') {
infoHider.innerHTML = 'Open Info'
infoContent.style.display = 'none'
} else {
infoHider.innerHTML = 'Close'
infoContent.style.display = 'block'
}
})
}

0 comments on commit 304cc3a

Please sign in to comment.