• krpano in layer loadscene zoomblend not work

    all setted blendmodes are work as plain blend mode

    here is my code bellow :

    <!DOCTYPE html>
    <html xmlns:th="http://www.thymeleaf.org">
    <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, viewport-fit=cover" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="mobile-web-app-capable" content="yes" />
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta http-equiv="x-ua-compatible" content="IE=edge" />
    <script src="/krpano/krpano.js"></script>
    <script src="/js/jquery-3.7.1.min.js"></script>
    <script src="/js/jquery.blockUI.js"></script>
    <script src="/js/dayjs_1.11.13.min.js"></script>
    <script src="/js/lodash_full_4.17.15.js"></script>
    <script src="/js/turf_7.2.0.min.js"></script>
    <link rel="stylesheet" href="/fontawesome-free-6.7.2-web/css/all.min.css">
    <style>
    html { height:100%; }
    body { height:100%; overflow:hidden; margin:0; padding:0; font-family:"Malgun Gothic"; font-size:16px; color:#FFFFFF; background-color:#000000; }
    #pano{width: 100vw;height: 100vh;position: absolute;}
    .loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: auto;
    }

    @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
    }

    </style>
    </head>
    <body>
    <div id="pano"></div>
    <script>
    const mainxml=`<krpano>
    <view limitview="lookrange" fovmin="1.0" fovmax="100.0" hlookat="0.0"/>
    <control zoomtocursor="true" bouncinglimits="true" />
    <style name="subkrpano" type="krpano" onloaded.addevent="layerLoaded()" />
    <layer name="container" type="container" x="0" width="100%" height="100%">
    <layer name="main" width="100%" height="100%" style="subkrpano" bgcolor="0xFFFFFF">
               
    </layer>
    </layer>
    <scene name="scene1">
    <preview url="http://localhost:81/panofile/68776…preview.jpg%22/>
    <image>
    <cube url="http://localhost:81/panofile/68776…s_%25v_%25h.jpg" multires="512,1280,2546"/>
    </image>
    <include url="/krpano/arrows.xml"/>
    <layer type="text" html="btn1" x="0" onclick="jscall(click(1))"/>
    <layer type="text" html="btn2" x="100" onclick="jscall(click(2))"/>
    <layer type="text" html="sbtn1" x="200" onclick="jscall(subclick(1))"/>
    <layer type="text" html="sbtn2" x="300" onclick="jscall(subclick(2))"/>
    <layer name="connections">
    <connection name="arrow_a5d72cef47a74bfc959d5ec0bfa1a0ac" hdir="179.29108877085434" vdir="0" arrowstyle="default-arrow" shadowstyle="default-shadow" shape="default-arrow-shape" shadow="true"/>
    <connection name="arrow_3d8e8fb257b24395b03b6081904af618" hdir="0.3764927203800994" vdir="0" arrowstyle="default-arrow" shadowstyle="default-shadow" shape="default-arrow-shape" shadow="true"/>
    </layer>
    </scene>
    <scene name="scene2" title="2025-07-17" thumburl="http://localhost:81/panofile/68776…tiles/thumb.jpg" index="0">
    <preview url="http://localhost:81/panofile/68776…preview.jpg%22/>
    <image>
    <cube url="http://localhost:81/panofile/68776…s_%25v_%25h.jpg" multires="512,1280,2546"/>
    </image>
    <include url="/krpano/arrows.xml"/>
    <layer type="text" html="btn1" x="0" onclick="jscall(click(1))"/>
    <layer type="text" html="btn2" x="100" onclick="jscall(click(2))"/>
    <layer type="text" html="sbtn1" x="200" onclick="jscall(subclick(1))"/>
    <layer type="text" html="sbtn2" x="300" onclick="jscall(subclick(2))"/>
    <layer name="connections">
    <connection name="arrow_b4c955cbd36543ee903460b9f2edb445" hdir="1.7535921956002198" vdir="0" arrowstyle="default-arrow" shadowstyle="default-shadow" shape="default-arrow-shape" shadow="true"/>
    </layer>
    </scene>
    <action name="layerLoaded" type="js"><![CDATA[
    layerInited(caller.krpano);
    ]]></action>
    </krpano>`;
    function click(idx){
    krpano.actions.loadscene('scene'+idx, null, 'MERGE', 'ZOOMBLEND(0.5,2,easeInOutSine)');
    console.log('click',idx);
    }

    function subclick(idx){
    const scene=subkrpano.scene.getItem('scene'+idx);
    subkrpano.actions.loadscene(scene.name, null, 'MERGE', 'ZOOMBLEND(0.5,2,easeInOutSine)');
    console.log('subclick',idx);
    }

    function layerInited(subkrpano){
    window.subkrpano=subkrpano;
    let subKrpanoXml = '<krpano>'
    + '<view fov="90" />'
    + '<scene name="scene1">'+ krpano.scene.getItem('scene1').content + '</scene><scene name="scene2">' + krpano.scene.getItem('scene2').content + '</scene>'
    + '</krpano>';
    subkrpano.actions.includexmlstring(subKrpanoXml, function () {
    console.log('includexmlstring done');
    subclick(1);
    });
    }

    embedpano({swf: null,xml:null, target:"pano",html5: "only",onready: function(krpano){
    window.krpano=krpano;
    krpano.call('showlog(true)');
    krpano.actions.loadxml(mainxml);
    }});
    </script>
    </body>
    </html>


    click function's zoomblend work well but subclick function's zoomblend work as plain blend


    how can i fix it?

  • Hi,

    the reason is that krpano-sub-layers are embedded by default with a transparent background - and a transparent rendering background is not compatible with all blending modes.

    As 'fix' provide a custom background color for the krpano sub layer:

    krpano.com - Documentation - XML Reference

    E.g. in your case:

    Code
    <style name="subkrpano" type="krpano" krpanobgcolor="0x000000" onloaded.addevent="layerLoaded()" />

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!