stear/example/start.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-08-13 17:52:45 +02:00
import { Stear, SWindow, _ } from "../stear/main.js";
2022-06-09 16:26:27 +02:00
import { fadein, fadeout, wait } from "../stear/utils.js";
2022-08-13 17:52:45 +02:00
import connect from "./connect.js";
2022-06-09 15:29:53 +02:00
export const preRender = true;
2022-08-13 17:52:45 +02:00
var wobel = Stear.addAnimation({
"0%": {
transform: "translate(-50%, -50%) scale(100%)"
},
"50%": {
transform: "translate(-50%, -50%) scale(110%)"
},
"100%": {
transform: "translate(-50%, -50%) scale(100%)"
}
});
2022-06-09 15:29:53 +02:00
2022-08-13 17:52:45 +02:00
export const call = (stear, { find, resolve, render, call, event }, args) => {
2022-06-09 15:29:53 +02:00
2022-08-13 17:52:45 +02:00
event.onloaded = async ()=>{
2022-06-09 15:29:53 +02:00
await wait(Math.max(1, 1000 - performance.now()));
2022-08-13 17:52:45 +02:00
await fadeout(find.main);
call(connect, { id: "123-456", name: "Device" });
2022-06-09 15:29:53 +02:00
resolve();
2022-08-13 17:52:45 +02:00
}
return _({ style: { zindex: 1000 }, find: "main" }, [
_({
type: "img", src: "http://localhost:82/images/logo.png", style: {
width: "80vw",
maxWidth: "75vh",
position: "absolute",
left: "50%",
top: "50%",
transform: "translate(-50%, -50%)",
animation: `${wobel} 2s ease-in-out 0s infinite`,
}
})
]);
2022-06-09 15:29:53 +02:00
}
2022-08-13 17:52:45 +02:00
export default new SWindow({ preRender: true, call, backgroundColor:"#dde"});