"Script Nou" - Processing

ID Autor Duplicat din Ultima modificare
#6684 6B-Necsulescu Stefan Matei (Stefan_Matei_Necsulescu) - Miercuri, 16 apr 2025, 18:05
x
 
1
function setup() {
2
  createCanvas(400, 400);
3
  noLoop(); // Stops unnecessary looping
4
5
  // Create a loading bar
6
  let loadingDiv = createDiv('Loading...');
7
  loadingDiv.style('width', '100px');
8
  loadingDiv.style('height', '20px');
9
  loadingDiv.style('background', '#ddd');
10
  loadingDiv.style('position', 'absolute');
11
  loadingDiv.style('top', '50%');
12
  loadingDiv.style('left', '50%');
13
  loadingDiv.style('transform', 'translate(-50%, -50%)');
14
  loadingDiv.style('text-align', 'center');
15
  loadingDiv.style('line-height', '20px');
16
  loadingDiv.style('border-radius', '5px');
17
18
  // Create the iframe
19
  let iframe = createElement('iframe', '');
20
  iframe.attribute('src', 'https://cageoflife.com/a-detailed-guide-to-github-io-games');
21
  iframe.attribute('width', '400');
22
  iframe.attribute('height', '400');
23
  iframe.style('border', 'none');
24
  iframe.style('position', 'absolute');
25
  iframe.style('top', '0');
26
  iframe.style('left', '0');
27
28
  // Hide loading bar when the iframe loads
29
  iframe.elt.onload = () => {
30
    loadingDiv.remove();
31
  };
32
}
33
Du-te sus!