Skip to content

Commit

Permalink
Fix offset to auto choose direction
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasarooniZ committed Apr 2, 2024
1 parent b61f26e commit 7597657
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ function createRulesLawyerEffect(vidFile, data, sfxFile) {
const delay = getSetting("delay") * 1000;
const scale = videoScale * getSetting("scale") * getSetting("player.scale");
const imgOffset = {
x: scale * videoWidth,
y: scale * videoHeight,
x: scale * videoWidth * getImageOffset(position).x,
y: scale * videoHeight * getImageOffset(position).y,
};

// Create effect sequence
Expand Down Expand Up @@ -130,6 +130,21 @@ function getAnchor(position) {
}
}

function getImageOffset(position) {
switch (position) {
case "bot-left":
return { x: 0, y: -1 };
case "bot-right":
return { x: -1, y: -1 };
case "top-left":
return { x: 0, y: 0 };
case "top-right":
return { x: -1, y: 0 };
default:
return { x: 0.5, y: 1 };
}
}

function getUIOffset(position) {
switch (position) {
case "bot-left":
Expand Down

0 comments on commit 7597657

Please sign in to comment.