Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
kisahklasik authored Aug 4, 2024
1 parent 22682da commit 6c9a97c
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,11 @@ <h1>Example Twibbon</h1>

// combine image
function gen() {
// let baseIMG = document.getElementById("avatar");
// let overlayIMG = document.getElementById("frame");
// let canvas = document.getElementById("result");
// let context = canvas.getContext("2d");

var baseIMG = document.getElementById("avatar"),
overlayIMG = document.getElementById("frame"),
canvas = document.getElementById("result"),
// context = canvas.getContext("2d");
imagePosition;
let baseIMG = document.getElementById("avatar");
let overlayIMG = document.getElementById("frame");
let canvas = document.getElementById("result");
let context = canvas.getContext("2d");
imagePosition;

// canvas.width = 1024;
// canvas.height = 1024;
Expand All @@ -140,9 +135,7 @@ <h1>Example Twibbon</h1>

bImage.style.backgroundImage = 'url(' + image.src + ')';
imagePosition = canvasImageCoverPosition(baseIMG.naturalWidth, baseIMG.naturalHeight , canvas2.width, canvas2.height);

// canvas1.getContext('2d').drawImage(image, 0, 0, image.naturalWidth, image.naturalHeight);
canvas.getContext('2d').drawImage(baseIMG, imagePosition.offsetLeft, imagePosition.offsetTop, imagePosition.width, imagePosition.height);
context.drawImage(baseIMG, imagePosition.offsetLeft, imagePosition.offsetTop, imagePosition.width, imagePosition.height);

// Download
function dlPNG() {
Expand Down

0 comments on commit 6c9a97c

Please sign in to comment.