three.js - 把场景放在div中

问题描述 投票:-2回答:1

我一直在寻找答案,但似乎无法使它适用于这个特定的场景。

https://codepen.io/rkimo/pen/vdwxJj

基本上我只想在div中使用这个blob所以我可以在前后放置内容并且能够滚动它。

如果它更容易,我不需要具有滚动放大和缩小blob的功能。

提前致谢

#blobcontainer {
  background:pink;
height:300px;
}




html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}.container {
  height: 100vh;
  width: 100vw;
}
canvas {
  position: absolute;
  background: #1f1d26;
  width: 100%; height: 100%;
}
css three.js cdn
1个回答
0
投票

只是不要实现handleMouseWheel函数,所以滚动你的three.js场景将不会影响three.js,它应该只是继续滚动页面:

function handleMouseWheel(event) {
    // do nothing ...
}
© www.soinside.com 2019 - 2024. All rights reserved.