-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
31 lines (31 loc) · 1.32 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html>
<head>
<script src="./photopea.min.js"></script>
</head>
<body>
<div id="container" style="width: 800px; height: 400px;"></div>
<script>
let container = document.getElementById("container");
Photopea.createEmbed(container).then(async (pea) => {
let output = await pea.runScript(`
app.echoToOE("hello world");
`);
console.log(output)
await pea.openFromURL("https://www.photopea.com/api/img2/pug.png", false);
await pea.runScript(`app.activeDocument.activeLayer.blendMode = "lddg";`);
await pea.openFromURL("https://www.photopea.com/api/img2/pug.png", true);
await pea.runScript(`app.activeDocument.activeLayer.blendMode = "scrn";`);
await pea.runScript(`app.activeDocument.activeLayer.translate(20, 20);`);
output = await pea.runScript(`
app.echoToOE("hello world 2");
`);
console.log(output)
let finalImage = await pea.exportImage();
let img = new Image();
img.src = URL.createObjectURL(finalImage);
document.body.appendChild(img);
});
</script>
</body>
</html>