Skip to content

Commit

Permalink
should be golden now
Browse files Browse the repository at this point in the history
Lukas Radl committed Apr 8, 2024
1 parent f569e10 commit 8009bd8
Showing 4 changed files with 93 additions and 24 deletions.
10 changes: 6 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@
<link rel="preload" as="image" href="static/demo/horns/horns.gif">
<link rel="preload" as="image" href="static/demo/horns/basquiat.gif">
<link rel="preload" as="image" href="static/demo/flower/flower.gif">
<link rel="preload" as="image" href="static/demo/flower/flower_style.gif">
<link rel="preload" as="image" href="static/demo/flower/darkred.gif">
<link rel="preload" as="image" href="static/demo/horns/wave.gif">
<link rel="preload" as="image" href="static/demo/hornswave/red.gif">
@@ -320,10 +321,11 @@ <h3 class="title is-4">Local Stylization</h3>
</div>
<div id="flower" class="is-hidden">
<img src="static/style/circles.png" class="circle-selected" id="flower_circles"
onclick="changeGIF('circles', this)">
onclick="changeGIF('circles', this)">
<img src="static/style/picasso.jpeg" class="circle"
onclick="changeGIF('picasso', this)">
<img src="static/style/wave.png" class="circle" onclick="changeGIF('wave', this)">
onclick="changeGIF('picasso', this)">
<img src="static/style/wave.png" class="circle"
onclick="changeGIF('wave', this)">
</div>
<div id="lego" class="is-hidden">
<img src="static/style/basquiat.jpg" class="circle-selected" id="lego_basquiat"
@@ -361,7 +363,7 @@ <h3 class="title is-4">Local Stylization</h3>
<div class="columns is-centered">
<div class="column is-full-width">
<div class="b-dics">
<img src="static/demo/horns/horns.gif" alt="NeRF" id="gif_ref">
<img src="static/demo/horns/horns_style.gif" alt="NeRF" id="gif_ref">
<img src="static/demo/horns/basquiat.gif" alt="Ours" id="gif_style">
</div>
</div>
Binary file added static/demo/flower/flower_style.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/demo/horns/horns_style.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 87 additions & 20 deletions static/js/index.js
Original file line number Diff line number Diff line change
@@ -136,19 +136,36 @@ function changeScene(scene, style_base) {

var im_ref = document.getElementById("gif_ref")
var im = document.getElementById("gif_style");
const loadImage = src =>
new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = reject;
img.src = src;
});

let name = currentScene
if (name.includes('flower')) {
name = 'flower_style'
}
if (name.includes('horns')) {
name = 'horns_style'
}

let images = [
const imageUrls = [
"static/demo/" + currentScene + '/' + style_base + ".gif",
"static/demo/" + currentScene + '/' + currentScene + ".gif"
"static/demo/" + currentScene + '/' + name + ".gif"
]

whereto = [
im,
im_ref
]

images.forEach(function (value, i) {
whereto[i].src = value;
Promise.all(imageUrls.map(loadImage)).then(images => {
images.forEach((image, i) =>
whereto[i].src = image.src
);
});

var circle = document.getElementById(currentScene + '_' + style_base);
@@ -185,18 +202,28 @@ function changeSceneRecolor(scene, style_base) {
var im = document.getElementById("recgif_style");
var im_ref = document.getElementById("recgif_ref")

let images = [
const loadImage = src =>
new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = reject;
img.src = src;
});

const imageUrls = [
"static/demo/" + currentSceneRecolor + '/' + style_base + ".gif",
"static/demo/" + currentSceneRecolor + '/' + currentSceneRecolor + ".gif"
]
];

whereto = [
im,
im_ref
]

images.forEach(function (value, i) {
whereto[i].src = value;
Promise.all(imageUrls.map(loadImage)).then(images => {
images.forEach((image, i) =>
whereto[i].src = image.src
);
});

var circle = document.getElementById(currentSceneRecolor + '_' + style_base);
@@ -228,7 +255,15 @@ function changeSceneRecolorStyle(scene, style_base) {
var im_ref = document.getElementById("rsgif_ref")
var im = document.getElementById("rsgif_style");

let images = [
const loadImage = src =>
new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = reject;
img.src = src;
});

const imageUrls = [
"static/demo/" + currentSceneRecolorStyle + '/' + style_base + ".gif",
"static/demo/" + currentSceneRecolorStyle + '/' + currentSceneRecolorStyle + ".gif"
]
@@ -238,8 +273,10 @@ function changeSceneRecolorStyle(scene, style_base) {
im_ref
]

images.forEach(function (value, i) {
whereto[i].src = value;
Promise.all(imageUrls.map(loadImage)).then(images => {
images.forEach((image, i) =>
whereto[i].src = image.src
);
});

var circle = document.getElementById(currentSceneRecolorStyle + '_' + style_base);
@@ -267,7 +304,15 @@ function changeGIF(style_image, image) {
var im = document.getElementById("gif_style")
var im_ref = document.getElementById("gif_ref")

let images = [
const loadImage = src =>
new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = reject;
img.src = src;
});

const imageUrls = [
"static/demo/" + currentScene + '/' + style_image + ".gif",
im_ref.src
]
@@ -277,8 +322,10 @@ function changeGIF(style_image, image) {
im_ref
]

images.forEach(function (value, i) {
whereto[i].src = value;
Promise.all(imageUrls.map(loadImage)).then(images => {
images.forEach((image, i) =>
whereto[i].src = image.src
);
});

}
@@ -293,7 +340,15 @@ function changeGIFrecolor(color, image) {
var im = document.getElementById("recgif_style")
var im_ref = document.getElementById("recgif_ref")

let images = [
const loadImage = src =>
new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = reject;
img.src = src;
});

const imageUrls = [
"static/demo/" + currentSceneRecolor + '/' + color + ".gif",
im_ref.src
]
@@ -303,8 +358,10 @@ function changeGIFrecolor(color, image) {
im_ref
]

images.forEach(function (value, i) {
whereto[i].src = value;
Promise.all(imageUrls.map(loadImage)).then(images => {
images.forEach((image, i) =>
whereto[i].src = image.src
);
});
}

@@ -318,7 +375,15 @@ function changeGIFrecolorstyle(color, image) {
var im = document.getElementById("rsgif_style")
var im_ref = document.getElementById("rsgif_ref")

let images = [
const loadImage = src =>
new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = reject;
img.src = src;
});

const imageUrls = [
"static/demo/" + currentSceneRecolorStyle + '/' + color + ".gif",
im_ref.src
]
@@ -328,7 +393,9 @@ function changeGIFrecolorstyle(color, image) {
im_ref
]

images.forEach(function (value, i) {
whereto[i].src = value;
Promise.all(imageUrls.map(loadImage)).then(images => {
images.forEach((image, i) =>
whereto[i].src = image.src
);
});
}

0 comments on commit 8009bd8

Please sign in to comment.