chinese直男口爆体育生外卖, 99久久er热在这里只有精品99, 又色又爽又黄18禁美女裸身无遮挡, gogogo高清免费观看日本电视,私密按摩师高清版在线,人妻视频毛茸茸,91论坛 兴趣闲谈,欧美 亚洲 精品 8区,国产精品久久久久精品免费

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

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

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

在Harmony上實(shí)現(xiàn)AnimateCSS動(dòng)畫

OpenHarmony技術(shù)社區(qū) ? 來源:OpenHarmony技術(shù)社區(qū) ? 作者:OpenHarmony技術(shù)社區(qū) ? 2022-04-26 11:00 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

顯式動(dòng)畫

ef6f74ee-c480-11ec-bce3-dac502259ad0.png參考文檔:
https://gitee.com/openharmony/docs/blob/5654c2b940ab3e2f4f0baf435e630c4ef3536428/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md

來看一個(gè)簡(jiǎn)單的示例:
@Entry
@Component
structAnimationPage{
//位移屬性
@State_translate:TranslateOptions={
x:0,
y:0,
z:0
}

build(){
Flex({
alignItems:ItemAlign.Center,
justifyContent:FlexAlign.Center,
direction:FlexDirection.Column
}){
Button('執(zhí)行動(dòng)畫').margin({bottom:50}).onClick(()=>{
//添加一個(gè)簡(jiǎn)單顯式動(dòng)畫
animateTo({
duration:1000,//動(dòng)畫時(shí)長(zhǎng)
tempo:0.5,//播放速率
curve:Curve.EaseInOut,//動(dòng)畫曲線
delay:0,//動(dòng)畫延遲
iterations:1,//播放次數(shù)
playMode:PlayMode.Normal,//動(dòng)畫模式
},()=>{
//閉包內(nèi)更改狀態(tài)
this._translate={
x:0,
y:100,
z:0
}
})
})

Column(){
Text('Animate.css')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.fontColor('#351c75')
.translate(this._translate)//位移變換
}
}
.width('100%')
.height('100%')
}
}
ef7b3022-c480-11ec-bce3-dac502259ad0.gif

如果我們希望向下位移完成后,再向右位移,就需要在第一個(gè)動(dòng)畫完成后再進(jìn)行第二個(gè)動(dòng)畫,即在第一個(gè)動(dòng)畫的 onFinish 函數(shù)中執(zhí)行第二個(gè)動(dòng)畫。

ef8a0ee4-c480-11ec-bce3-dac502259ad0.gif

這樣組合起來可以構(gòu)成一個(gè)更復(fù)雜的連續(xù)動(dòng)畫

//單步動(dòng)畫執(zhí)行函數(shù)
animationStep(value:AnimateParam,event:()=>void){
return()=>{
returnnewPromise((resolve)=>{
letonFinish=value.onFinish
value.onFinish=()=>{
if(onFinish)onFinish()
resolve(true)
}
animateTo(value,event)
})
}
}

創(chuàng)建 4 步動(dòng)畫:

aboutToAppear(){
//每步動(dòng)畫執(zhí)行時(shí)長(zhǎng)
lettime=200
this.step1=this.animationStep({
duration:time,//動(dòng)畫時(shí)長(zhǎng)
tempo:0.5,//播放速率
curve:Curve.EaseInOut,//動(dòng)畫曲線
delay:0,//動(dòng)畫延遲
iterations:1,//播放次數(shù)
playMode:PlayMode.Normal,//動(dòng)畫模式
onFinish:()=>{
//動(dòng)畫執(zhí)行完成
console.info('playend')
}
},()=>{
//閉包內(nèi)更改狀態(tài)
this._translate={
x:0,
y:100,
z:0
}
})


this.step2=this.animationStep({
duration:time,//動(dòng)畫時(shí)長(zhǎng)
tempo:0.5,//播放速率
curve:Curve.EaseInOut,//動(dòng)畫曲線
delay:0,//動(dòng)畫延遲
iterations:1,//播放次數(shù)
playMode:PlayMode.Normal,//動(dòng)畫模式
onFinish:()=>{
//動(dòng)畫執(zhí)行完成
console.info('playend')
}
},()=>{
//閉包內(nèi)更改狀態(tài)
this._translate={
x:100,
y:100,
z:0
}
})

this.step3=this.animationStep({
duration:time,//動(dòng)畫時(shí)長(zhǎng)
tempo:0.5,//播放速率
curve:Curve.EaseInOut,//動(dòng)畫曲線
delay:0,//動(dòng)畫延遲
iterations:1,//播放次數(shù)
playMode:PlayMode.Normal,//動(dòng)畫模式
onFinish:()=>{
//動(dòng)畫執(zhí)行完成
console.info('playend')
}
},()=>{
//閉包內(nèi)更改狀態(tài)
this._translate={
x:100,
y:0,
z:0
}
})

this.step4=this.animationStep({
duration:time,//動(dòng)畫時(shí)長(zhǎng)
tempo:0.5,//播放速率
curve:Curve.EaseInOut,//動(dòng)畫曲線
delay:0,//動(dòng)畫延遲
iterations:1,//播放次數(shù)
playMode:PlayMode.Normal,//動(dòng)畫模式
onFinish:()=>{
//動(dòng)畫執(zhí)行完成
console.info('playend')
}
},()=>{
//閉包內(nèi)更改狀態(tài)
this._translate={
x:0,
y:0,
z:0
}
})
}

順序執(zhí)行 4 步動(dòng)畫:

Button('執(zhí)行動(dòng)畫').margin({bottom:50}).onClick(async()=>{
awaitthis.step1()
awaitthis.step2()
awaitthis.step3()
awaitthis.step4()
})

實(shí)現(xiàn) AnimateCSS 動(dòng)畫

AnimateCSS:

https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.css

https://animate.style/
pulse 動(dòng)畫:efa67a5c-c480-11ec-bce3-dac502259ad0.gif

看下 pulse 動(dòng)畫樣式代碼:

.animate__pulse{
-webkit-animation-name:pulse;
animation-name:pulse;
-webkit-animation-timing-function:ease-in-out;
animation-timing-function:ease-in-out;
}

@keyframespulse{
from{
-webkit-transform:scale3d(1,1,1);
transform:scale3d(1,1,1);
}

50%{
-webkit-transform:scale3d(1.05,1.05,1.05);
transform:scale3d(1.05,1.05,1.05);
}

to{
-webkit-transform:scale3d(1,1,1);
transform:scale3d(1,1,1);
}
}

ETS 實(shí)現(xiàn):

@State_scale:ScaleOptions={
x:1,
y:1,
z:1
}

...

Column(){
Text('Animate.css')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.fontColor('#351c75')
.translate(this._translate)//位移變換
.scale(this._scale)//比例變化
}

動(dòng)畫方法:
  • 傳遞一個(gè)動(dòng)畫總時(shí)長(zhǎng) time

  • 第一步動(dòng)畫執(zhí)行段為 0%-50%,所以動(dòng)畫執(zhí)行時(shí)長(zhǎng)為總時(shí)長(zhǎng)time * 50%

  • 第二步動(dòng)畫執(zhí)行段為 50%-100%,所以動(dòng)畫執(zhí)行時(shí)長(zhǎng)為總時(shí)長(zhǎng)time * 50%

	
asyncpulse(time){
//0%-50%
letstep1=this.animationStep({
duration:time*0.5,//動(dòng)畫時(shí)長(zhǎng)
tempo:0.5,//播放速率
curve:Curve.EaseInOut,//動(dòng)畫曲線
delay:0,//動(dòng)畫延遲
iterations:1,//播放次數(shù)
playMode:PlayMode.Normal,//動(dòng)畫模式
},()=>{
this._scale={
x:1.05,
y:1.05,
z:1.05
}
})

//50%-100%
letstep2=this.animationStep({
duration:time*0.5,//動(dòng)畫時(shí)長(zhǎng)
tempo:0.5,//播放速率
curve:Curve.EaseInOut,//動(dòng)畫曲線
delay:0,//動(dòng)畫延遲
iterations:1,//播放次數(shù)
playMode:PlayMode.Normal,//動(dòng)畫模式
},()=>{
this._scale={
x:1,
y:1,
z:1
}
})

awaitstep1()
awaitstep2()
}

執(zhí)行動(dòng)畫:

Button('執(zhí)行PULSE動(dòng)畫').margin({bottom:50}).onClick(async()=>{
this.pulse(500)
})

efc6b9d4-c480-11ec-bce3-dac502259ad0.gif

審核編輯 :李倩


聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • 函數(shù)
    +關(guān)注

    關(guān)注

    3

    文章

    4381

    瀏覽量

    64907
  • Harmony
    +關(guān)注

    關(guān)注

    0

    文章

    108

    瀏覽量

    3021

原文標(biāo)題:在鴻蒙上實(shí)現(xiàn)AnimateCSS動(dòng)畫

文章出處:【微信號(hào):gh_834c4b3d87fe,微信公眾號(hào):OpenHarmony技術(shù)社區(qū)】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。

收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評(píng)論

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

    harmony-utils之CacheUtil,緩存工具類

    harmony-utils之CacheUtil,緩存工具類
    的頭像 發(fā)表于 07-04 16:36 ?126次閱讀

    harmony-utils之CharUtil,字符工具類

    harmony-utils之CharUtil,字符工具類
    的頭像 發(fā)表于 07-04 16:34 ?129次閱讀

    harmony-utils之CrashUtil,異常相關(guān)工具類

    harmony-utils之CrashUtil,異常相關(guān)工具類
    的頭像 發(fā)表于 07-04 16:33 ?126次閱讀

    harmony-utils之DeviceUtil,設(shè)備相關(guān)工具類

    harmony-utils之DeviceUtil,設(shè)備相關(guān)工具類
    的頭像 發(fā)表于 07-03 18:27 ?162次閱讀

    harmony-utils之DisplayUtil,屏幕相關(guān)工具類

    harmony-utils之DisplayUtil,屏幕相關(guān)工具類
    的頭像 發(fā)表于 07-03 18:26 ?141次閱讀

    harmony-utils之EmitterUtil,Emitter工具類

    harmony-utils之EmitterUtil,Emitter工具類
    的頭像 發(fā)表于 07-03 18:24 ?143次閱讀

    harmony-utils之FileUtil,文件相關(guān)工具類

    harmony-utils之FileUtil,文件相關(guān)工具類
    的頭像 發(fā)表于 07-03 18:23 ?138次閱讀

    harmony-utils之FormatUtil,格式化工具類

    harmony-utils之FormatUtil,格式化工具類
    的頭像 發(fā)表于 07-03 18:22 ?142次閱讀

    harmony-utils之ImageUtil,圖片相關(guān)工具類

    harmony-utils之ImageUtil,圖片相關(guān)工具類
    的頭像 發(fā)表于 07-03 18:22 ?174次閱讀

    harmony-utils之LRUCacheUtil,LRUCache緩存工具類

    harmony-utils之LRUCacheUtil,LRUCache緩存工具類 harmony-utils 簡(jiǎn)介與說明 harmony-utils 一款功能豐富且極易上手的HarmonyOS工具庫
    的頭像 發(fā)表于 07-03 18:11 ?139次閱讀

    harmony-utils之PreviewUtil,文件預(yù)覽工具類

    harmony-utils之PreviewUtil,文件預(yù)覽工具類 harmony-utils 簡(jiǎn)介與說明 [harmony-utils] 一款功能豐富且極易上手的HarmonyOS工具庫,借助眾多
    的頭像 發(fā)表于 07-03 11:40 ?122次閱讀

    harmony-utils之StrUtil,字符串工具類

    harmony-utils之StrUtil,字符串工具類 harmony-utils 簡(jiǎn)介與說明 [harmony-utils] 一款功能豐富且極易上手的HarmonyOS工具庫,借助眾多實(shí)用工具類
    的頭像 發(fā)表于 07-03 11:32 ?100次閱讀

    harmony-utils之TypeUtil,類型檢查工具類

    harmony-utils之TypeUtil,類型檢查工具類 harmony-utils 簡(jiǎn)介與說明 [harmony-utils] 一款功能豐富且極易上手的HarmonyOS工具庫,借助眾多
    的頭像 發(fā)表于 06-30 17:35 ?114次閱讀

    harmony-utils之DateUtil,日期工具類

    harmony-utils之DateUtil,日期工具類
    的頭像 發(fā)表于 06-25 22:15 ?62次閱讀

    用DeepSeek-R1實(shí)現(xiàn)自動(dòng)生成Manim動(dòng)畫

    ? 作者:算力魔方創(chuàng)始人/英特爾創(chuàng)新大使劉力 前面我們分享了本地運(yùn)行能與OpenAI-o1 能力相媲美的DeepSeek-R1 模型。本文將介紹如何使用DeepSeek-R1實(shí)現(xiàn)自動(dòng)生成Manim
    的頭像 發(fā)表于 02-07 12:31 ?3364次閱讀
    用DeepSeek-R1<b class='flag-5'>實(shí)現(xiàn)</b>自動(dòng)生成Manim<b class='flag-5'>動(dòng)畫</b>