在线观看www成人影院-在线观看www日本免费网站-在线观看www视频-在线观看操-欧美18在线-欧美1级

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

SwipeGesture和RotationGesture手勢

ArkUI詳解 ? 2022-12-07 19:24 ? 次閱讀

# SwipeGesture

用于觸發(fā)滑動(dòng)事件,滑動(dòng)速度大于100vp/s時(shí)可識(shí)別成功。

參數(shù)名稱 參數(shù)類型 必填 參數(shù)描述
fingers number 觸發(fā)滑動(dòng)的最少手指數(shù),默認(rèn)為1,最小為1指,最大為10指。 默認(rèn)值:1
direction SwipeDirection 觸發(fā)滑動(dòng)手勢的滑動(dòng)方向。 默認(rèn)值:SwipeDirection.All
speed number 識(shí)別滑動(dòng)的最小速度(默認(rèn)為100VP/秒)。 默認(rèn)值:100

SwipeDirection的三個(gè)枚舉值

declare enum SwipeDirection {
    /**
     * Default.
     * @since 8
     */
    None,
    /**
     * Sliding horizontally.
     * @since 8
     */
    Horizontal,
    /**
     * Sliding Vertical
     * @since 8
     */
    Vertical,
    /**
     * Sliding in all directions.
     * @since 8
     */
    All
}
  • All:所有方向。
  • Horizontal:水平方向,手指滑動(dòng)方向與x軸夾角小于45度時(shí)觸發(fā)。
  • Vertical:豎直方向,手指滑動(dòng)方向與y軸夾角小于45度時(shí)觸發(fā)。
  • None:任何方向均不可觸發(fā)。

    事件

* Slide gesture recognition success callback.
 * @since 8
 */
onAction(event: (event?: GestureEvent) => void): SwipeGestureInterface;

完整代碼

@Entry
@Component
struct SwipeGestureExample {
  @State rotateAngle: number = 0
  @State speed: number = 1
?
  build() {
    Column() {
      Column() {
        Text("滑動(dòng) 速度" + this.speed)
        Text("滑動(dòng) 角度" + this.rotateAngle)
      }
      .border({ width: 3 })
      .width(300)
      .height(200)
      .margin(100)
      .rotate({
?
?
        angle: this.rotateAngle,})
      // 單指豎直方向滑動(dòng)時(shí)觸發(fā)該事件
      .gesture(
      SwipeGesture({
        fingers:2,
        direction: SwipeDirection.All })
        .onAction((event: GestureEvent) => {
          this.speed = event.speed
          this.rotateAngle = event.angle
        })
      )
    }.width('100%')
  }
}

RotationGesture

用于觸發(fā)旋轉(zhuǎn)手勢事件,觸發(fā)旋轉(zhuǎn)手勢的最少手指為2指,最大為5指,最小改變度數(shù)為1度。

數(shù)名稱 參數(shù)類型 必填 參數(shù)描述
fingers number 觸發(fā)旋轉(zhuǎn)的最少手指數(shù), 最小為2指,最大為5指。 默認(rèn)值:2
angle number 觸發(fā)旋轉(zhuǎn)手勢的最小改變度數(shù),單位為deg。 默認(rèn)值:1

提供了四種事件

事件

  • ** onActionStart(event: (event?: GestureEvent) => void):Rotation手勢識(shí)別成功回調(diào)。**
  • onActionUpdate(event: (event?: GestureEvent) => void):Rotation手勢移動(dòng)過程中回調(diào)。
  • ** onActionEnd(event: (event?: GestureEvent) => void):Rotation手勢識(shí)別成功,手指抬起后觸發(fā)回調(diào)。**
  • ** onActionCancel(event: () => void):Rotation手勢識(shí)別成功,接收到觸摸取消事件觸發(fā)回調(diào)。**
* Pan gesture recognition success callback.
     * @since 7
     */
    onActionStart(event: (event?: GestureEvent) => void): RotationGestureInterface;
    /**
     * Callback when the Pan gesture is moving.
     * @since 7
     */
    onActionUpdate(event: (event?: GestureEvent) => void): RotationGestureInterface;
    /**
     * The Pan gesture is successfully recognized. When the finger is lifted, the callback is triggered.
     * @since 7
     */
    onActionEnd(event: (event?: GestureEvent) => void): RotationGestureInterface;
    /**
     * The Pan gesture is successfully recognized and a callback is triggered when the touch cancel event is received.
     * @since 7
     */
    onActionCancel(event: () => void): RotationGestureInterface;
}

完整代碼:

// xxx.ets
@Entry
@Component
struct RotationGestureExample {
  @State angle: number = 0
  @State rotateValue: number = 0
?
  build() {
    Column() {
      Column() {
        Text('旋轉(zhuǎn)角度:' + this.angle)
      }
      .height(200)
      .width(300)
      .padding(20)
      .border({ width: 3 })
      .margin(80)
      .rotate({ angle: this.angle })
      // 雙指旋轉(zhuǎn)觸發(fā)該手勢事件
      .gesture(
      RotationGesture()
        .onActionStart((event: GestureEvent) => {
          console.info('Rotation start')
        })
        .onActionUpdate((event: GestureEvent) => {
          this.angle = this.rotateValue + event.angle
?
        })
        .onActionEnd(() => {
          this.rotateValue = this.angle
          console.info('Rotation end')
        }).onActionCancel(()=>{
        console.info('Rotation onActionCancel')
      })
      )
    }.width('100%')
  }
}

用于觸發(fā)滑動(dòng)事件,滑動(dòng)速度大于100vp/s時(shí)可識(shí)別成功。

參數(shù)名稱 參數(shù)類型 必填 參數(shù)描述
fingers number 觸發(fā)滑動(dòng)的最少手指數(shù),默認(rèn)為1,最小為1指,最大為10指。 默認(rèn)值:1
direction SwipeDirection 觸發(fā)滑動(dòng)手勢的滑動(dòng)方向。 默認(rèn)值:SwipeDirection.All
speed number 識(shí)別滑動(dòng)的最小速度(默認(rèn)為100VP/秒)。 默認(rèn)值:100

SwipeDirection的三個(gè)枚舉值

declare enum SwipeDirection {
    /**
     * Default.
     * @since 8
     */
    None,
    /**
     * Sliding horizontally.
     * @since 8
     */
    Horizontal,
    /**
     * Sliding Vertical
     * @since 8
     */
    Vertical,
    /**
     * Sliding in all directions.
     * @since 8
     */
    All
}
  • All:所有方向。
  • Horizontal:水平方向,手指滑動(dòng)方向與x軸夾角小于45度時(shí)觸發(fā)。
  • Vertical:豎直方向,手指滑動(dòng)方向與y軸夾角小于45度時(shí)觸發(fā)。
  • None:任何方向均不可觸發(fā)。

    事件

* Slide gesture recognition success callback.
 * @since 8
 */
onAction(event: (event?: GestureEvent) => void): SwipeGestureInterface;

完整代碼

@Entry
@Component
struct SwipeGestureExample {
  @State rotateAngle: number = 0
  @State speed: number = 1
?
  build() {
    Column() {
      Column() {
        Text("滑動(dòng) 速度" + this.speed)
        Text("滑動(dòng) 角度" + this.rotateAngle)
      }
      .border({ width: 3 })
      .width(300)
      .height(200)
      .margin(100)
      .rotate({
?
?
        angle: this.rotateAngle,})
      // 單指豎直方向滑動(dòng)時(shí)觸發(fā)該事件
      .gesture(
      SwipeGesture({
        fingers:2,
        direction: SwipeDirection.All })
        .onAction((event: GestureEvent) => {
          this.speed = event.speed
          this.rotateAngle = event.angle
        })
      )
    }.width('100%')
  }
}

RotationGesture

用于觸發(fā)旋轉(zhuǎn)手勢事件,觸發(fā)旋轉(zhuǎn)手勢的最少手指為2指,最大為5指,最小改變度數(shù)為1度。

數(shù)名稱 參數(shù)類型 必填 參數(shù)描述
fingers number 觸發(fā)旋轉(zhuǎn)的最少手指數(shù), 最小為2指,最大為5指。 默認(rèn)值:2
angle number 觸發(fā)旋轉(zhuǎn)手勢的最小改變度數(shù),單位為deg。 默認(rèn)值:1

提供了四種事件

事件

  • ** onActionStart(event: (event?: GestureEvent) => void):Rotation手勢識(shí)別成功回調(diào)。**
  • onActionUpdate(event: (event?: GestureEvent) => void):Rotation手勢移動(dòng)過程中回調(diào)。
  • ** onActionEnd(event: (event?: GestureEvent) => void):Rotation手勢識(shí)別成功,手指抬起后觸發(fā)回調(diào)。**
  • ** onActionCancel(event: () => void):Rotation手勢識(shí)別成功,接收到觸摸取消事件觸發(fā)回調(diào)。**
* Pan gesture recognition success callback.
     * @since 7
     */
    onActionStart(event: (event?: GestureEvent) => void): RotationGestureInterface;
    /**
     * Callback when the Pan gesture is moving.
     * @since 7
     */
    onActionUpdate(event: (event?: GestureEvent) => void): RotationGestureInterface;
    /**
     * The Pan gesture is successfully recognized. When the finger is lifted, the callback is triggered.
     * @since 7
     */
    onActionEnd(event: (event?: GestureEvent) => void): RotationGestureInterface;
    /**
     * The Pan gesture is successfully recognized and a callback is triggered when the touch cancel event is received.
     * @since 7
     */
    onActionCancel(event: () => void): RotationGestureInterface;
}

完整代碼:

// xxx.ets
@Entry
@Component
struct RotationGestureExample {
  @State angle: number = 0
  @State rotateValue: number = 0
?
  build() {
    Column() {
      Column() {
        Text('旋轉(zhuǎn)角度:' + this.angle)
      }
      .height(200)
      .width(300)
      .padding(20)
      .border({ width: 3 })
      .margin(80)
      .rotate({ angle: this.angle })
      // 雙指旋轉(zhuǎn)觸發(fā)該手勢事件
      .gesture(
      RotationGesture()
        .onActionStart((event: GestureEvent) => {
          console.info('Rotation start')
        })
        .onActionUpdate((event: GestureEvent) => {
          this.angle = this.rotateValue + event.angle
?
        })
        .onActionEnd(() => {
          this.rotateValue = this.angle
          console.info('Rotation end')
        }).onActionCancel(()=>{
        console.info('Rotation onActionCancel')
      })
      )
    }.width('100%')
  }
}
聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報(bào)投訴
  • 手勢識(shí)別
    +關(guān)注

    關(guān)注

    8

    文章

    227

    瀏覽量

    48180
  • 觸摸
    +關(guān)注

    關(guān)注

    8

    文章

    199

    瀏覽量

    64824
  • OpenHarmony
    +關(guān)注

    關(guān)注

    28

    文章

    3836

    瀏覽量

    18220
  • OpenHarmony3.1
    +關(guān)注

    關(guān)注

    0

    文章

    11

    瀏覽量

    655
收藏 人收藏

    評(píng)論

    相關(guān)推薦
    熱點(diǎn)推薦

    紅外手勢識(shí)別方案 紅外手勢感應(yīng)模塊 紅外識(shí)別紅外手勢識(shí)別

    紅外手勢識(shí)別方案,適用于多種領(lǐng)域,如音響,可實(shí)現(xiàn)通過手勢識(shí)別暫停,開始,上一首,下一首;智能家居,如電動(dòng)窗簾,感應(yīng)馬桶等;電子產(chǎn)品,如臺(tái)燈開關(guān)以及亮度的調(diào)節(jié)。
    發(fā)表于 08-27 16:37

    Android 手勢識(shí)別

    本帖最后由 kiter_rp 于 2014-9-11 14:23 編輯 總體來分析手勢有關(guān)涉及到手勢匹配相關(guān)的源碼類之間的關(guān)系,如下圖: 上圖中的相關(guān)類簡介:GestureLibrary:手勢
    發(fā)表于 09-11 14:22

    使用SensorTile識(shí)別手勢

    你好, 我正在嘗試使用SensorTile實(shí)現(xiàn)手勢識(shí)別,開發(fā)我的固件我開始研究BlueMicrosystem2示例,因此我能夠檢測到簡單的手勢作為手腕的方向?,F(xiàn)在我想要認(rèn)識(shí)一些更復(fù)雜的手勢,比如
    發(fā)表于 09-10 17:18

    手勢識(shí)別控制器制作

    目錄智能家居硬件小制作(含源碼)《手勢識(shí)別控制器》基于PAJ7620手勢模塊、L298N驅(qū)動(dòng)板、arduino介紹材料PAJ7620手勢模塊參數(shù)硬件連接庫文件使用其他硬件制作手勢識(shí)別控
    發(fā)表于 09-07 06:45

    HarmonyOS應(yīng)用API手勢方法-綁定手勢方法

    述:為組件綁定不同類型的手勢事件,并設(shè)置事件的響應(yīng)方法。Api:從API Version 7開始支持一、綁定手勢識(shí)別:通過如下屬性給組件綁定手勢識(shí)別,手勢識(shí)別成功后可以通過事件回調(diào)通知
    發(fā)表于 11-23 15:53

    HarmonyOS應(yīng)用API手勢方法-RotationGesture

    描述:用于觸發(fā)旋轉(zhuǎn)手勢事件,觸發(fā)旋轉(zhuǎn)手勢的最少手指為2指,最大為5指,最小改變度數(shù)為1度。Api:從API Version 7開始支持接口:RotationGesture(value?: &
    發(fā)表于 11-30 10:42

    HarmonyOS應(yīng)用API手勢方法-RotationGesture

    描述:用于觸發(fā)旋轉(zhuǎn)手勢事件,觸發(fā)旋轉(zhuǎn)手勢的最少手指為2指,最大為5指,最小改變度數(shù)為1度。Api:從API Version 7開始支持接口:RotationGesture(value?: &
    發(fā)表于 11-30 10:43

    HarmonyOS應(yīng)用API手勢方法-SwipeGesture

    描述:用于觸發(fā)滑動(dòng)事件,滑動(dòng)最小速度為100vp/s時(shí)識(shí)別成功。Api:從API Version 8開始支持接口:SwipeGesture(value?: { fingers
    發(fā)表于 12-01 17:29

    HarmonyOS/OpenHarmony(Stage模型)應(yīng)用開發(fā)單一手勢(三)

    五、旋轉(zhuǎn)手勢RotationGesture) .RotationGesture(value?:{fingers?:number; angle?:number}) 旋轉(zhuǎn)手勢用于觸發(fā)旋轉(zhuǎn)
    發(fā)表于 09-06 14:14

    HarmonyOS/OpenHarmony(Stage模型)應(yīng)用開發(fā)組合手勢(三)互斥識(shí)別

    的觸發(fā)條件為滑動(dòng)距離達(dá)到5vp,先達(dá)到觸發(fā)條件的手勢觸發(fā)??梢酝ㄟ^修改SwipeGesture和PanGesture的參數(shù)以達(dá)到不同的效果。
    發(fā)表于 09-11 15:01

    基于加鎖機(jī)制的靜態(tài)手勢識(shí)別運(yùn)動(dòng)中的手勢

    基于 RGB-D( RGB-Depth)的靜態(tài)手勢識(shí)別的速度高于其動(dòng)態(tài)手勢識(shí)別,但是存在冗余手勢和重復(fù)手勢而導(dǎo)致識(shí)別準(zhǔn)確性不高的問題。針對該問題,提出了一種基于加鎖機(jī)制的靜態(tài)
    發(fā)表于 12-15 13:34 ?0次下載
    基于加鎖機(jī)制的靜態(tài)<b class='flag-5'>手勢</b>識(shí)別運(yùn)動(dòng)中的<b class='flag-5'>手勢</b>

    混合交互手勢模型設(shè)計(jì)

    分析了觸控交互技術(shù)在移動(dòng)手持設(shè)備及可穿戴設(shè)備的應(yīng)用現(xiàn)狀及存在的問題.基于交互動(dòng)作的時(shí)間連續(xù)性及空間連續(xù)性。提出了將觸控交互動(dòng)作的接觸面軌跡與空間軌跡相結(jié)合。同時(shí)具有空中手勢及觸控手勢的特性及優(yōu)點(diǎn)
    發(fā)表于 12-26 11:15 ?0次下載
    混合交互<b class='flag-5'>手勢</b>模型設(shè)計(jì)

    手勢識(shí)別技術(shù)及其應(yīng)用

    手勢識(shí)別技術(shù)是一種通過計(jì)算機(jī)視覺和人工智能技術(shù)來分析和識(shí)別人類手勢動(dòng)作的技術(shù)。它主要利用傳感器、攝像頭等設(shè)備捕捉手勢信息,然后通過算法對捕捉到的手勢信息進(jìn)行處理和分析,從而實(shí)現(xiàn)對
    的頭像 發(fā)表于 06-14 18:12 ?2799次閱讀

    車載手勢識(shí)別技術(shù)的原理及其應(yīng)用

    車載手勢識(shí)別技術(shù)是一種利用計(jì)算機(jī)視覺和人工智能技術(shù)來識(shí)別和理解駕駛員手勢的技術(shù)。該技術(shù)通過使用傳感器、攝像頭等設(shè)備捕捉駕駛員的手勢動(dòng)作,然后通過算法對捕捉到的手勢動(dòng)作進(jìn)行識(shí)別和分析,以
    的頭像 發(fā)表于 06-27 18:09 ?1971次閱讀

    鴻蒙ArkTS聲明式開發(fā):跨平臺(tái)支持列表RotationGesture之基礎(chǔ)手勢

    用于觸發(fā)旋轉(zhuǎn)手勢事件,觸發(fā)旋轉(zhuǎn)手勢的最少手指為2指,最大為5指,最小改變度數(shù)為1度。
    的頭像 發(fā)表于 06-18 09:27 ?563次閱讀
    鴻蒙ArkTS聲明式開發(fā):跨平臺(tái)支持列表<b class='flag-5'>RotationGesture</b>之基礎(chǔ)<b class='flag-5'>手勢</b>
    主站蜘蛛池模板: 国产精品久久久久久久人热 | 亚洲偷偷| 免费国产在线视频 | 五月香婷婷| 在线看欧美成人中文字幕视频 | 88影视在线观看污污 | 天天看片中文字幕 | 一级片免费观看视频 | 女人被两根一起进3p在线观看 | 婷婷五月在线视频 | 五月国产综合视频在线观看 | 国产性片在线观看 | 日本精品高清一区二区2021 | 日本黄色美女网站 | 天天干夜夜操美女 | 婷婷深爱五月 | 天天干天天爽天天操 | 国产福利精品视频 | 午夜在线观看免费视频 | 亚洲大成色www永久网 | 夜夜爽天天干 | 色婷婷亚洲综合五月 | 日本在线视频www色 日本在线视频精品 | aaa一区二区三区 | 丁香六月在线 | 手机福利在线 | 午夜三级毛片 | 国产伦精品一区二区免费 | 久久 在线播放 | 色综合精品 | 俺也来俺也去俺也射 | 色之综综 | 亚洲欧美经典 | 国产成人a | 天天干天天做天天射 | 偷偷狠狠的日日日日 | 久操免费在线 | 亚洲最色网站 | 久久六月丁香婷婷婷 | 俄罗斯一级特黄黄大片 | 天天干夜夜爽 |