Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<script>
import { onMount } from 'svelte';
import * as THREE from 'three';

const url = 'https://images.unsplash.com/photo-1608229063899-4fd8fb97969b?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=100&w=100';
let file;
let imageBitmap;
let cacheEnabled = false;

$: THREE.Cache.enabled = cacheEnabled;

$: cacheEnabled, (async () => {
console.log('loading file');
const fileLoader = new THREE.FileLoader();
file = await (new Promise((resolve) => {
fileLoader.load(url, (v) => {
console.log('fileLoader onLoad');
resolve(v);
});
}));

console.log(THREE.Cache.get(url));

console.log('loading imageBitmap');
const imageBitmapLoader = new THREE.ImageBitmapLoader();
imageBitmap = await (new Promise((resolve) => {
imageBitmapLoader.load(url, (v) => {
console.log('imageBitmapLoader onLoad');
resolve(v);
});
}));

console.log(THREE.Cache.get(url));
})();

console.log('finished..');
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */