【问题标题】:Postion Stage/layer over html video在 html 视频上放置舞台/图层
【发布时间】:2013-10-18 21:41:11
【问题描述】:

我有一个 HTML5 视频和一个动态舞台/图层(画布)。 我想将舞台/图层直接放在视频上,因为我打算创建形状。 舞台始终默认为浏览器的 0,0 位置。如何设置舞台/图层的位置直接位于视频上方某个 x、y 位置。 我尝试使用 stage.setAbsolutePosition(56,75) 但它不起作用。

感谢高级。

【问题讨论】:

    标签: canvas kineticjs layer stage


    【解决方案1】:

    使用一些 CSS 定位您的 KinectJS Stage 容器和 Video 容器:

    虚构的 HTML 和 CSS 的非常粗略的示例:

    <div class="viewport">
       <div id="videoContainer">...</div>
       <div id="kineticContainer">...</div>
     </div>
    
    .viewport {
      position: relative;
    }
    
    #kineticContainer {
       ...
       background-color: transparent;
       position: absolute;
       x: 56px;
       y: 75px;
       z-index: 2;//or whatever this needs to be
       ...
    } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-04
      • 2021-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多