avatar

目录
parabola-js demo page

抛物线测试


html

 <body>
     <section class="wrap">
       <p>抛物线测试</p>
       <hr>
       <div class="box-1">
         <div class="r-item"></div>
         <div class="r-target"></div>
       </div>
     </section>
 </body>   

 <script src="https://cdn.jsdelivr.net/npm/parabola-js@1.0.1/lib/parabola.js"></script>

JavaScript

    const box1 = document.querySelector('.box-1');
    const rItem = document.querySelector('.r-item');
    const rTarget = document.querySelector('.r-target');

    // ie8+ 1
    box1.addEventListener('click', e => {
    const diffX = e.offsetX + box1.scrollLeft;
    const diffY = e.offsetY + box1.scrollTop;
    rTarget.style.left = diffX + 'px';
    rTarget.style.top = diffY + 'px';
    new Parabola(rItem, rTarget, {
      endScale: '0.3',
    }).init();
    })
文章作者: kshao
文章链接: https://blog.ksh7.com/2020/03/19/demo-parabola-js/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 kshao-blog
打赏
  • 微信
    微信
  • 支付寶
    支付寶