JSON Tool - 02/01/2023
v1.0
Kicking up a new year with a new tool to make things easier for me when it comes to updating my website. anyway, it's a tool that allows you to edit JSON arrays with ease, just paste the JSON with the array there and the script will prompt you to select the array you want to add values to, if the array has existing fields it will pick them automatically as an example and prompt you to fill them.
That's it, I hope everyone have a really good 2023.
Sprite Tool - 27/12/2022
v2.0
I just released a new version of my Sprite Sheet Tool here on the website. This version includes the ability to create sprite sheets with horizontal or vertical orientation, making it even more flexible and useful for your sprite sheet needs.
You can find the updated python version of the script on the GitHub repository, where you'll also find instructions on how to use it.
Sprite Tool - 22/12/22
v1.0
Released the Sprite Sheet Tools to be usable online here at the website These tools are hella useful for creating sprite sheets and splitting them up into individual images. I was going to use them to make a cool animation, but unfortunately I had to scrap the project due to time constraints. But I figured that these tools might be useful to someone else, so I decided to release them to the public.
Changes to the movie ratings page - 21/12/2022
Movie Page
- Added new movies to the list
- Changed the way the movie posters are displayed
- Modified the layout of the page
- Changed the way the movie posters are displayed so that they only load when the mouse is hovering over the movie's name
Script Development
- Added a feature to the script that allows the user to input the name, rating, and image url for multiple movies at once
- Implemented a search function using the Google Custom Search API to automatically retrieve the image url for a movie based on its name
- Added an option for the user to choose from a list of image url options if the first one retrieved is broken
you can find the repo for the project plus instructions of how to use it by clicking here.
Resolution reduction for slower computers - 21/12/2022
To improve performance on slower computers, I added a feature that reduces the resolution of the render if the frames per second (fps) fall below a certain threshold.
Changes Made:
- Added a variable to keep track of the current fps using the `Date` object.
- Calculated the fps in the `animate` function by comparing the current time with the `lastTime` variable.
- Added a check to see if the fps falls below a certain threshold, and reduced the resolution by changing the size of the renderer if necessary.
- Used the `setTimeout` function to cap the fps at a certain value by delaying the call to `requestAnimationFrame`.
Example:
// Declare this at the start of your script
let fps = 0;
let lastTime = Date.now();
function animate() {
// Calculate fps
fps = 1000 / (Date.now() - lastTime);
lastTime = Date.now();
// Check if fps is below threshold and reduce resolution if necessary
if (fps < 20) {
renderer.setSize(window.innerWidth / 2, window.innerHeight / 2);
} else {
renderer.setSize(window.innerWidth, window.innerHeight);
}
// your animated functions
// Delay the next frame by 33.3 milliseconds to achieve a target fps of 30
setTimeout(function () {
requestAnimationFrame(animate);
}, 33.3);
}
This will reduce the resolution by 50% if the fps falls below 20, and will cap the fps at 30. If You plan to use the code above for your proejcts, feel free to adjust the threshold and the amount of reduction to your liking.