Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaTMT authored May 19, 2024
1 parent 92d8ce1 commit 772602a
Show file tree
Hide file tree
Showing 11 changed files with 6,825 additions and 64 deletions.
130 changes: 130 additions & 0 deletions Node.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-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/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# 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 variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# 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

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# 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

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@




[Youtube Link](https://www.youtube.com/watch?v=r-gXuVMoRhY&ab_channel=TaylorThreader)
39 changes: 8 additions & 31 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<body>
<div id="globe-container"></div>


<button id="edit_button">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48">
<image xlink:href="assets/images/settings_icon.svg" width="48" height="48"/>
Expand All @@ -18,45 +17,23 @@
<div id="ui-container"></div>





<script src="libraries/p5.min.js"></script>
<script src="libraries/p5.sound.min.js"></script>
<script src="/js/globals.js"></script>
<script src="/js/globe.js"></script>
<script src="/js/UI.js"></script>
<script src="/js/sketch.js"></script>
<script src="js/globals.js"></script>
<script src="js/globe.js"></script>
<script src="js/UI.js"></script>
<script src="js/sketch.js"></script>


<script>
const settingsButton = document.getElementById('edit_button');
const uiContainer = document.getElementById('ui-container');
const globeContainer = document.getElementById('globe-container');


settingsButton.addEventListener('click', function(){
console.log("clicked");
if (uiContainer.style.display === 'none' || uiContainer.style.display === '') {
uiContainer.style.display = 'block';


const canvas = document.querySelector('canvas');
const newWidth = window.innerWidth * 0.7;
canvas.style.width = newWidth + 'px';

globeContainer.style.left = (window.innerWidth * 0.3) + 'px';
} else {
uiContainer.style.display = 'none';

const canvas = document.querySelector('canvas');
canvas.style.width = window.innerWidth + 'px';
globeContainer.style.left = '0';
}
});

settingsButton.addEventListener('click', settings);



</script>


</body>
</html>
34 changes: 24 additions & 10 deletions js/UI.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
var sketch_UI = function(p) {
let uiContainerWidth, uiContainerHeight;
let x, connectionSliderY, lineThicknessSliderY, lineColourPickerY, sphereColourPickerY, backgroundColourPickerY;

let textSizePercentage = 0.06;
let textSizeValue = p.width * textSizePercentage;

p.preload = function(){

}

p.setup = function() {
uiContainerWidth = screenWidth * 0.3
uiContainerHeight = screenHeight;
uiContainerHeight = window.innerHeight;

console.log(uiContainerHeight, uiContainerWidth)

p.canvas = p.createCanvas(uiContainerWidth, uiContainerHeight);
p.canvas.style('background-color', 'transparent');

x = uiContainerWidth * 0.1;
x = 20;
// Calculate positions for slider and color picker

connectionSliderY = uiContainerHeight * 0.05;
lineThicknessSliderY = uiContainerHeight * 0.10;
lineColourPickerY = uiContainerHeight * 0.15;
sphereColourPickerY = uiContainerHeight * 0.21;
backgroundColourPickerY = uiContainerHeight * 0.27;
connectionSliderY = uiContainerHeight * 0.1;
lineThicknessSliderY = uiContainerHeight * 0.2;
lineColourPickerY = uiContainerHeight * 0.3;
sphereColourPickerY = uiContainerHeight * 0.4;
backgroundColourPickerY = uiContainerHeight * 0.5;


p.connectionSlider = p.createSlider(0, 40, total);
Expand Down Expand Up @@ -62,6 +63,8 @@ var sketch_UI = function(p) {
p.draw = function() {
p.background(0);
p.fill(255);

p.textSize(textSizeValue);

p.text("Connections : " + total, x, connectionSliderY - 10);
p.text("Line Thickness : " + strokeWeightValue, x, lineThicknessSliderY - 10);
Expand Down Expand Up @@ -113,11 +116,22 @@ var sketch_UI = function(p) {

// On window resizing we adjust canvas size to ensure proportional reshaping
function adjustCanvasSize() {
let uiContainerWidth = document.getElementById('ui-container').offsetWidth;
p.resizeCanvas(uiContainerWidth, p.height);
uiContainerWidth = window.innerWidth * 0.3;
textSizePercentage = 0.05;
textSizeValue = p.width * textSizePercentage;
p.resizeCanvas(uiContainerWidth, uiContainerHeight);
}
window.addEventListener('resize', adjustCanvasSize);

const settingsButton = document.getElementById('edit_button');
settingsButton.addEventListener('click', adjustCanvasSize);


document.addEventListener('fullscreenchange', (event) => {
if (document.fullscreenElement)
adjustCanvasSize();
});

function getColourAdjustment(colourPicker){
let colour = colourPicker.color();
let r = Math.round(p.red(colour));
Expand Down
30 changes: 30 additions & 0 deletions js/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,33 @@ let sphereColour = 0;
let screenWidth = window.innerWidth;
let screenHeight = window.innerHeight;





function settings(){
const uiContainer = document.getElementById('ui-container');
const globeContainer = document.getElementById('globe-container');



if (uiContainer.style.display === 'none' || uiContainer.style.display === '') {
uiContainer.style.display = 'block';

const canvas = document.querySelector('canvas');
const newWidth = window.innerWidth * 0.7;
canvas.style.width = newWidth + 'px';

globeContainer.style.left = (window.innerWidth * 0.3) + 'px';
globeContainer.style.right = '0px';


} else {
uiContainer.style.display = 'none';

const canvas = document.querySelector('canvas');
canvas.style.width = window.innerWidth + 'px';
globeContainer.style.left = '0';
}
};

32 changes: 24 additions & 8 deletions js/globe.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,28 @@ var sketch_main = function(p){
}
}



const settingsButton = document.getElementById('edit_button');

settingsButton.addEventListener('click', function(){


window.addEventListener('resize', () => {
function settings(){
const uiContainer = document.getElementById('ui-container');
const globeContainer = document.getElementById('globe-container');


if (uiContainer.style.display === 'none' || uiContainer.style.display === '') {
const canvas = document.querySelector('canvas');
canvas.style.width = window.innerWidth + 'px';
globeContainer.style.right = '0';


} else {
const canvas = document.querySelector('canvas');
const newWidth = window.innerWidth * 0.7;
canvas.style.width = newWidth + 'px';

globeContainer.style.right = (window.innerWidth * 0.3) + 'px';
}
};

});
}


}
31 changes: 31 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { app, BrowserWindow } = require('electron');
const path = require('path');

function createWindow() {
const mainWindow = new BrowserWindow({
width: 800, // Set base width
height: 600, // Set base height
minWidth: 600, // Set minimum width
minHeight: 400, // Set minimum height
show: false, // Initially hide the window to prevent flickering
fullscreen: true, // Make the window fullscreen
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
nodeIntegration: true
}
});

mainWindow.loadFile('index.html');

// No need to manually set fullscreen and show, as it's already set in the options

// When the window is closed, quit the app on macOS
mainWindow.on('closed', () => {
app.quit();
});
}

app.on('ready', createWindow);

// No need to handle window-all-closed and activate events, as they are mainly for macOS

Loading

0 comments on commit 772602a

Please sign in to comment.