亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

??
Principle
?? ??
Chrome ??? ??? ???? API ?? ? ?? ??
Code
?? ??
額外的動(dòng)畫效果
安裝lottie-miniprogram包
? ?? ??? ?? ???? ?? ?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

Jan 11, 2022 pm 06:59 PM
?? ???? ????

?? ???? ????? 3D ?? ??? ?? ??? ?????? ?? ???? ? ?? ???? ?? ??? ?? ??? ???????. ?? ??? ??? ?? ????!

?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

APP? ?? ?? ?? ??? ? ??? ???? ?? ??? ???? ?? ??? ???. ? ? ?? ?? ??? ??????. "Ziruke APP?? ?? 3D ?? ??"??? ????? ??? ?? ?? 3D ?? ??? ??? Android ?? ?????? ??????.

?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

? ???? ??? ?? "?? ????" ?? ?????? ? ?? ???? ??? 3D ?? ?? ????? ?????? ??? ????.

Principle

?? ??? ?? ???? ?? ?? ???? ?? ???? ?? ???? ??? ??? ??? ????? ??? ??? ? ? ????(??? ??? ???? ????? ??? ???? ???? ??? ??? ??? ??? ?(?? ????? ??? ?????) ???? ?? ??? ?????? ??? ?? ??? ??? ???? ??? ?? ??.

????? iPhone? ???? ?? ???? ???? ?? ? ??? ??? ?????. ???? ?? ???? ???? ?? ???? ?? ?? ???? ??? ????? ??? ?? ??. (??? ??? ????)

?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

?? ??

??? ??? ?, ?? ??? ???????.

?? ???? ??? ???? wx.startDeviceMotionListening ? wx.onDeviceMotionChange?? ? ?? API? ???? ???. ??? ???? ? ?? wx.onDeviceMotionChange API? ???? ??????. ??? ??? API? ?? ? ?? ?? ?????.

?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

? API? ?? ???? ??, ??? ?? ??? ??? ????????? ?????. ???? Chrome ???? ??? ??? ???? ? ? ?? ?? ???? ?? ???? ????? ????????.

Chrome ??? ??? ???? API ?? ? ?? ??

???? ??? ??? ?? ?? ??? ?? ?? ???? ???.

?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

? ? ??? ???.

?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

咦? ??? ??? ? ????? ?, ??? ??? ? ?? ?? API ?? ?? ??? ?????. alpha=0, beta=90, gamma=0? ?? ???? ??? ???? ??? ??? ?? ? ? ???, ??? ????? ????? ?? ?? ??? ? ????. ?? ?? ????, ???? ??? ??? ???? ?? ????? ??? ? ????. ?? ?? ???? ??? ?? ???? ??? ? ?? ?? ?? ?? ??? ????.

?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

?? ?? -?? ????? ??? ?? ??? ???? ????.

?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

  • ??: 0?? 360??? Z?? ?? ??? ?? ??? ?????.
  • beta: ?? ??? ?????. x?? ?? ??? -180?? 180 ?????. ??? ?? ??? ??? ?????.
  • gamma: -90~90 ??? y??? ??? ?? ??? ?????. ??? ???? ????? ???? ??? ?????.

Code

wxml:

<view class="swiper-box">
  <image  wx:for="{{background}}" class="swiper-bg {{animationStart || current === index ? &#39;fadeIn&#39; : &#39;fadeOut&#39;}} "></image>
  <swiper indicator-dots="{{true}}" indicator-active-color="#fff" interval="{{3000}}" autoplay="{{true}}" circular="{{true}}" bindchange="handleChange" bindtransition="handleTransition" bindanimationfinish="handleFinish">
    <block wx:for="{{background}}" wx:key="*this">
      <swiper-item>
        <view class="swiper-item-content" >
          <image class="icon" src="../../images/cloud.png"  style="width: 90px; height: 90px;transform: translate3d({{x}}px, {{y}}px, {{z}}px);" wx:if="{{index === 0}}"></image>
          <image class="icon" src="../../images/firecrackers.png" style="width: 90px; height: 90px;transform: translate3d({{x}}px, {{y}}px, {{z}}px);" wx:else></image>
          <text class="text" wx:if="{{index === 0}}">新年快樂</text>
          <text class="text" wx:else>大吉大利</text>
        </view>
      </swiper-item>
    </block>
  </swiper>
</view>

??? swiper? swiper-item ?? ??? ??? ? ???? ?? ???? swiper? ??? ??? ???? ?? ?? ???? ????? ???

js :

// index.js
// 獲取應(yīng)用實(shí)例
const app = getApp()

Page({
  data: {
    background: [&#39;https://cloud-minapp-39237.cloud.ifanrusercontent.com/1n6jtVIbbJ3rnAv7.jpg&#39;, &#39;https://cloud-minapp-39237.cloud.ifanrusercontent.com/1n6mBOvOutOFQ3E8.png&#39;,],
    x: 0,
    y: 0,
    z: 0,
    animationFinish: true, // 動(dòng)畫是否執(zhí)行完成
    animationStart: false, // 是否開始執(zhí)行動(dòng)畫
    current: 0,
  },
  // 動(dòng)畫開始執(zhí)行
  handleTransition(e) {
    if (this.data.animationFinish) {
      this.setData({
        animationFinish: false,
        animationStart: true,
      })
    }
  },
  // 動(dòng)畫執(zhí)行結(jié)束
  handleFinish() {
    this.setData({
      animationFinish: true,
      animationStart: false,
    })
  },
  // current值變化
  handleChange(e) {
    this.setData({
      current: e.detail.current,
    })
  },
  onLoad() {

    const that = this;
    // 監(jiān)聽方向變化
    wx.startDeviceMotionListening({
      success() {
        wx.onDeviceMotionChange(function (res) {
          const {
            alpha, // 0-360
            beta, // -180-180
            gamma // -90- 90
          } = res
       
          const disX = gamma / 90 * 20 
          const disY = beta / 90 * 12
          let z = 0
          if (disX > 0 || disY > 0) {
            z = 20
          } else {
            z = -20
          }
          that.setData({
            x: disX,
            y: disY,
            z
          })
        })
      }
    })
  }
})

??? ??? ???

const disY = beta / 90 * 12

?? ??? ???? ??? ? ??? ?? ??? ??? ???? ??? ????? ???. ??? x, y? ??? ? ???? transform: translate3d()? ?? ??? ??? ??? ?????.

?? ??

?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.

??? ??? ??? ???? ?? ? ????. ? ?? ??? ????.

  • 素材圖是我網(wǎng)上找到拼湊而成,總體合成效果并不美觀,想達(dá)到較逼真的效果需要設(shè)計(jì)配合出素材圖;
  • 在偏移至最大值時(shí),未做緩沖動(dòng)畫,不合符直覺(這里后面有時(shí)間再研究實(shí)現(xiàn));

額外的動(dòng)畫效果

其實(shí)借助該方向API,我們還可以作為觸發(fā)動(dòng)畫的觸發(fā)器。例如在手機(jī)翻轉(zhuǎn)到一定角度值時(shí),我們可以播放煙花效果

安裝lottie-miniprogram包

npm i lottie-miniprogram

安裝完之后記得在微信開發(fā)者工具中點(diǎn)擊構(gòu)建npm包

wxml:

<canvas id="canvas" type="2d"   style="max-width:90%"></canvas>

js:

  onLoad() {
    // 初始化lottie動(dòng)畫
    wx.createSelectorQuery().select(&#39;#canvas&#39;).node(res => {
      const canvas = res.node
      const context = canvas.getContext(&#39;2d&#39;)
      lottie.setup(canvas)
      lottieInstance = lottie.loadAnimation({
        path: &#39;https://assets10.lottiefiles.com/packages/lf20_1qfekvox.json&#39;,
        autoplay: true,
        loop: false,
        rendererSettings:{
          context
        }
      })
    }).exec()
  }

然后在wx.onDeviceMotionChange中調(diào)用

lottieInstance.play()

處理觸發(fā)即可

完整代碼

https://github.com/pengjinlong/cases/tree/main/spring-article

本文轉(zhuǎn)載自:https://juejin.cn/post/7051490823497580574

作者:碼克吐溫

【相關(guān)學(xué)習(xí)推薦:小程序開發(fā)教程

? ??? ?? ?????? 3D ?? ?? ?? ??? ?? ??? ???? ??? ????.? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1597
29
PHP ????
1487
72
NYT ?? ??? ??
130
836
???
Python? ???? WeChat ??? ?? Python? ???? WeChat ??? ?? Jun 17, 2023 pm 06:34 PM

??? ??? ??? ????? ???? ?? WeChat? ???? ?? ???? ?? ??????? ?????. WeChat ?? ????? ???? ???? ??????? ?????? ???? ??? ?? ????? ?? ???? ? ?? ??? ?? ??? ??? ? ????. ? ????? Python? ???? WeChat ???? ???? ??? ?????. 1. ?? Python? ???? WeChat ???? ???? ?? ?? Python ?????? ???? ???. ???? wxpy? itchat ? ?????? ???? ?? ????. wxpy? ?? ?????

WeChat ?? ?????? ?? ??? ?? ?? WeChat ?? ?????? ?? ??? ?? ?? Nov 21, 2023 am 10:55 AM

WeChat ?? ?????? ?? ??? ?? ?? WeChat ?? ?????? ?? ??? ??? ???? ?? ??? ??? ????? ?? ??? ??? ???? ? ?? ???? ????? ?????. ??? WeChat ????? ?? ??? ??? ???? ??? ??? ???? ?? ?? ??? ?????. ??, ?? ????? ??? ???? ??? ? ?? ?? ??? ???? ???. ??? ?? ??? ???? ?? ??? ?? ??? ?? ??? ???? ?? ????. &lt;--index.wxml- -&gt;&l

Alipay, ?? ?? ?????? ???? ???? '?? ??-?? ??' ?? ???? ?? Alipay, ?? ?? ?????? ???? ???? '?? ??-?? ??' ?? ???? ?? Oct 31, 2023 pm 09:25 PM

10? 31? ? ???? ??? ??? ?? 5? 27? Ant Group? '?? ?? ????'? ????? ????? ?? ??? ??? ?????. Alipay? '?? ?? - ??? ?? ??' ?? ????? ??????. ?? ???? ?? ??? ?????? ???? ?? ???? ?? ??? ?? ??? ???? Alipay? ?? ??? ?? ??? ???? ? ??? ???. ?? ???? "????", "????" ?? ???? ???? "????" ???? ??? ? ????. ?? ?????? ???? ????? ?? ? ???? ?? ?? ??? ??? ??? ? ??? ?? ? Alipay ????? ?? ?????? ?? ??? ?????. ? ??????? ?? ??????? ?? ?? ?? ?? ??? ??? ? ??? ?????. ? ?? ??? ??? ???? ?? ??? ?? ???????. ??? ??

?? ????? ??? ? ???? ?? ????? ??? ? ???? Dec 29, 2022 am 11:06 AM

?? ????? ??? ??? ? ????. ?? ??: 1. "react-reconciler"? ???? ???? ???? DSL? ?????. 2. DSL? ?? ???? ????? ?? ?? ???? ?? ??? ????. 3. npm? ???? ???? ?????. ???? npm? ?????. 4. ??? ???? ???? ??? ?? API? ???? ??? ?????.

uniapp? ?? ????? H5 ?? ?? ??? ???? ?? uniapp? ?? ????? H5 ?? ?? ??? ???? ?? Oct 20, 2023 pm 02:12 PM

???? ?? ????? H5 ??? ??? ????? ???? ?? ??? ?????. ?? ??? ???? ??? ????? ???? ?? ?? ????? H5? ?? ?????? ??? ?????. ??? ??? ?? ?????? uniapp? ?? ??? ???? ?? ????? H5 ?? ??? ???? ???? ?? ???? ?? ???? ? ????. ? ????? uniapp? ?? ????? H5 ?? ??? ??? ???? ??? ???? ???? ?? ??? ?????. 1. ??? ??? ??

?? ?????? ?? ?? ??? ???? ???? ??? ?????(?? ???? ??). ?? ?????? ?? ?? ??? ???? ???? ??? ?????(?? ???? ??). Nov 04, 2022 pm 04:53 PM

?? ?? ?? ?? ????? ??? ? ?? ??? ?? ????, ?? ?????? ?? ?? ??? ???? ???? ??? ?? ???????.

Python?? ??? ?? ???? ?? ???? Python?? ??? ?? ???? ?? ???? May 08, 2023 pm 06:37 PM

?? ???? x01 ?? ?? ??, ?? ???? ??? ???? ???? ?????. ?? ??? ??? ??? ? ???? ?? ??? ?? ? ??? ?????. ?? ???? ???? ???? ??? ?? ??? ?????. x02 ?????? ??? ???? ?? ?????. ?????? ??? ???? ??? ?? ???? ?? ??? ???? ?????. ??? ??? ??? ????? ????? ??? ? ?? ???? ???? ???. ??? ??? ?? ???? ?? ??? ??? ?? ?????. ????, ??

PHP? ?? ????? ??? ??? ?? ?? ? ?? ?? PHP? ?? ????? ??? ??? ?? ?? ? ?? ?? Jul 04, 2023 pm 04:01 PM

PHP ? ?? ????? ??? ?? ?? ? ?? ?? ??? ?? ?? ? ?? ??? ?? ???? ??? ?? ? ??? ?????. ??? ??? ??? ?? ?? ?? ? ?? ??? ?? ???? ??? ???? ????. ?? ???? PHP? ???? ? ?? ???? ?? ?????. ? ????? PHP ? ?? ?????? ??? ?? ?? ? ?? ?? ?? ??? ???? ?? ?? ??? ?????. 1. PHP? ???? PHP??? ?? ????? ??? ? ????.

See all articles