53 lines
1.3 KiB
HTML
53 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Event Propagator</title>
|
|
<style>
|
|
html {
|
|
height: 100%;
|
|
}
|
|
|
|
body {
|
|
min-height: 100%;
|
|
position: relative;
|
|
margin: 0;
|
|
}
|
|
|
|
folk-shape {
|
|
background-color: black;
|
|
border-radius: 5px;
|
|
color: white;
|
|
padding: 0px 5px;
|
|
z-index: 10;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<folk-shape id="box1" x="100" y="100" width="30" height="30"></folk-shape>
|
|
<folk-shape id="box2" x="200" y="350">Hello World</folk-shape>
|
|
<folk-event-propagator
|
|
source="#box1"
|
|
target="#box2"
|
|
trigger="click"
|
|
expression="textContent: to.textContent + '!'"
|
|
></folk-event-propagator>
|
|
|
|
<folk-shape id="box3" x="350" y="200" width="30" height="30"></folk-shape>
|
|
<folk-shape id="box4" x="500" y="250" width="30" height="30"></folk-shape>
|
|
<folk-event-propagator
|
|
source="#box3"
|
|
target="#box4"
|
|
trigger="transform"
|
|
expression="y: from.x,
|
|
rotation: from.x/10"
|
|
></folk-event-propagator>
|
|
|
|
<script type="module">
|
|
import '../src/standalone/folk-shape.ts';
|
|
import '../src/standalone/folk-event-propagator.ts';
|
|
</script>
|
|
</body>
|
|
</html>
|