2016-03-17 23:23:51 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html><head>
|
|
|
|
<style>
|
|
|
|
.first {
|
2016-07-02 15:47:12 +03:00
|
|
|
transform: translateZ(10px);
|
2016-03-17 23:23:51 +03:00
|
|
|
background-color: blue;
|
2016-07-02 15:47:12 +03:00
|
|
|
top: 0px;
|
2016-03-17 23:23:51 +03:00
|
|
|
}
|
|
|
|
.second {
|
|
|
|
background-color: green;
|
2016-07-02 15:47:12 +03:00
|
|
|
top: 40px;
|
|
|
|
}
|
|
|
|
.preserve {
|
|
|
|
transform-style: preserve-3d;
|
2016-03-17 23:23:51 +03:00
|
|
|
}
|
|
|
|
.leaf {
|
|
|
|
width: 100px;
|
|
|
|
height: 100px;
|
|
|
|
position:absolute;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head><body>
|
|
|
|
|
2016-07-02 15:47:12 +03:00
|
|
|
<div class="preserve">
|
|
|
|
<div style="opacity:0.5">
|
|
|
|
<div class="leaf first"></div>
|
|
|
|
<canvas class="leaf second" width="100px" height="100px" id="canvas"></canvas>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-03-17 23:23:51 +03:00
|
|
|
<script>
|
|
|
|
var canvas = document.getElementById("canvas");
|
|
|
|
var ctx = canvas.getContext("2d");
|
|
|
|
ctx.fillStyle = "red";
|
|
|
|
ctx.fillRect(0, 0, 100, 100);
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|