Skip to content

Commit 6d1c24a

Browse files
committed
feat: add demo and settings for github action.
1 parent 91f012c commit 6d1c24a

File tree

8 files changed

+130
-7
lines changed

8 files changed

+130
-7
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build and Deploy Demo
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 22
20+
21+
- name: Install dependencies
22+
run: npm install
23+
24+
- name: Build demo
25+
run: npm run build:demo
26+
27+
- name: Deploy to GitHub Pages
28+
uses: peaceiris/actions-gh-pages@v3
29+
with:
30+
github_token: ${{ secrets.ACTION }}
31+
publish_dir: dist

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<h1 align="center">WebGL Tech Particles</h1>
22

33
<div align="center">
4-
<a href="https://github.com/a-rudenko/webgl-tech-particles/blob/main/LICENSE" target="_blank" style="text-decoration: none;">
4+
<a href="https://github.com/a-rudenko/webgl-tech-particles/blob/main/LICENSE">
55
<img src="https://img.shields.io/github/license/a-rudenko/webgl-tech-particles" alt="GitHub license" >
66
</a>
7-
<a href="https://www.npmjs.com/package/webgl-tech-particles" target="_blank" style="text-decoration: none;">
7+
<a href="https://www.npmjs.com/package/webgl-tech-particles">
88
<img src="https://img.shields.io/npm/v/webgl-tech-particles" alt="Latest version">
99
</a>
10-
<a href="https://www.npmjs.com/package/webgl-tech-particles" target="_blank" style="text-decoration: none;">
10+
<a href="https://www.npmjs.com/package/webgl-tech-particles">
1111
<img src="https://img.shields.io/bundlephobia/min/webgl-tech-particles" alt="Minified size">
1212
</a>
13-
<a href="https://www.npmjs.com/package/webgl-tech-particles" target="_blank" style="text-decoration: none;">
13+
<a href="https://www.npmjs.com/package/webgl-tech-particles">
1414
<img src="https://img.shields.io/npm/dw/webgl-tech-particles" alt="npm" >
1515
</a>
1616
</div>
@@ -21,6 +21,8 @@ This project is an interactive 3D visualization of technology icons (e.g., JavaS
2121
implemented with WebGL and Three.js. Particles representing different technologies move dynamically in a 3D space,
2222
connecting with each other based on customizable parameters.
2323

24+
<a href="https://a-rudenko.github.io/webgl-tech-particles/demo.html">Live demo</a>
25+
2426
<h2>Install</h2>
2527

2628
Using npm:
@@ -83,9 +85,11 @@ You can also use this package directly in the browser via CDN without installing
8385

8486
<h2>Settings</h2>
8587

86-
Example with basic <a href="https://github.com/a-rudenko/webgl-tech-particles/blob/main/settings.json" target="_blank">
88+
Example with basic <a href="https://github.com/a-rudenko/webgl-tech-particles/blob/main/settings.json">
8789
settings</a>.
8890

91+
<i>You can also export settings from the <a href="https://a-rudenko.github.io/webgl-tech-particles/demo.html">demo</a> version.</i>
92+
8993
Below is a description of the settings.
9094

9195
<h3>Particle Settings:</h3>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webgl-tech-particles",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Interactive 3D particle system with technology icons using WebGL",
55
"main": "dist/webgl-tech-particles.js",
66
"module": "dist/webgl-tech-particles.js",
@@ -10,6 +10,7 @@
1010
"scripts": {
1111
"start": "webpack serve",
1212
"build": "webpack --mode production",
13+
"build:demo": "webpack --config webpack.demo.config.js --mode production",
1314
"prepare": "npm run build"
1415
},
1516
"keywords": [

src/demo/demo.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>WebGL Tech Particles</title>
5+
<meta charset="utf-8">
6+
<meta name="description" content="Interactive 3D particle system with technology icons using WebGL and Three.js">
7+
<meta name="keywords" content="animation, javascript, geometric, particles, webgl, three.js, 3d, technologies">
8+
<meta name="author" content="Aleksey Rudenko">
9+
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
10+
<link rel="icon" type="image/x-icon" href="favicon.ico">
11+
</head>
12+
<body>
13+
<div id="tech-particles"></div>
14+
<script type="module">
15+
import { initWebGLTechParticles } from './<%= htmlWebpackPlugin.files.js[0] %>';
16+
initWebGLTechParticles('tech-particles');
17+
</script>
18+
</body>
19+
</html>

src/demo/favicon.ico

14.3 KB
Binary file not shown.

src/texture.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const DEFAULT_ICONS = [
2626
'open-ai.webp',
2727
];
2828

29-
const DEFAULT_ICON_FOLDER = './dist/assets/icons';
29+
const DEFAULT_ICON_FOLDER = ICON_FOLDER;
3030

3131
const loadTexture = (textureLoader, path) => {
3232
return new Promise((resolve) => {

webpack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path');
22
const CopyWebpackPlugin = require('copy-webpack-plugin');
33
const TerserPlugin = require('terser-webpack-plugin');
4+
const webpack = require('webpack');
45

56
module.exports = {
67
entry: './src/index.js',
@@ -55,5 +56,8 @@ module.exports = {
5556
{from: 'src/assets/icons', to: 'assets/icons'},
5657
],
5758
}),
59+
new webpack.DefinePlugin({
60+
ICON_FOLDER: JSON.stringify('./dist/assets/icons'),
61+
}),
5862
],
5963
};

webpack.demo.config.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
const path = require('path');
2+
const CopyWebpackPlugin = require('copy-webpack-plugin');
3+
const HtmlWebpackPlugin = require('html-webpack-plugin');
4+
const webpack = require('webpack');
5+
6+
module.exports = {
7+
entry: './src/demo/demo.js',
8+
mode: 'production',
9+
output: {
10+
filename: 'webgl-tech-particles.demo.js',
11+
path: path.resolve(__dirname, 'dist'),
12+
library: {
13+
type: 'module',
14+
},
15+
clean: true,
16+
},
17+
experiments: {
18+
outputModule: true,
19+
},
20+
module: {
21+
rules: [
22+
{
23+
test: /\.js$/,
24+
exclude: /node_modules/,
25+
use: {
26+
loader: 'babel-loader',
27+
options: {
28+
presets: ['@babel/preset-env'],
29+
},
30+
},
31+
},
32+
{
33+
test: /\.css$/,
34+
use: ['style-loader', 'css-loader'],
35+
},
36+
{
37+
test: /\.(png|jpg|gif|webp)$/,
38+
type: 'asset/resource',
39+
generator: {
40+
filename: 'assets/icons/[name][ext]',
41+
},
42+
},
43+
],
44+
},
45+
plugins: [
46+
new CopyWebpackPlugin({
47+
patterns: [
48+
{from: 'settings.json', to: 'settings.json'},
49+
{from: 'src/assets/icons', to: 'assets/icons'},
50+
{from: 'src/demo/favicon.ico', to: 'favicon.ico'},
51+
],
52+
}),
53+
new HtmlWebpackPlugin({
54+
template: 'src/demo/demo.html',
55+
filename: 'demo.html',
56+
title: 'WebGL Tech Particles Demo',
57+
inject: true,
58+
scriptLoading: 'module',
59+
}),
60+
new webpack.DefinePlugin({
61+
ICON_FOLDER: JSON.stringify('./assets/icons'),
62+
}),
63+
],
64+
};

0 commit comments

Comments
 (0)