五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

CocosCreator:常用于動(dòng)畫的緩動(dòng)類Easing

2021-12-01 17:24 作者:會(huì)飛的蝸牛007  | 我要投稿

定義:以非線性的方式修改值的函數(shù),通常用于動(dòng)畫。

在cocoscreator中有easing各字段的屬性,預(yù)定義的?Easing?函數(shù)具有以下形式:

字段:

BounceIn:

跳轉(zhuǎn)到最終值,然后退回,最后確定最終值

BounceOut:

跳轉(zhuǎn)至最終值,退回 3 次,然后確定

CubicIn:

啟動(dòng)緩慢,然后逐漸加速

CubicInOut:

加速和減速。 通常是一個(gè)看起來(lái)正常的選擇

CubicOut:

快速啟動(dòng),然后減速

Linear:

線性轉(zhuǎn)換

SinIn:

平穩(wěn)加速

SinInOut:

加速進(jìn)入,減速退出

SinOut:

平穩(wěn)減速

SpringIn:

移動(dòng),然后跳轉(zhuǎn)至最終值

SpringOut:

????

迭代過(guò)度,然后返回

當(dāng)然還有很多,cocosCreator內(nèi)置了這些函數(shù),可以直接在tween中使用

creator3.2的API

cocoscreator3.x的api個(gè)人看起來(lái)很費(fèi)勁,所以還是到2.x中去扒

Easing:緩動(dòng)函數(shù)類,為?Tween?提供緩動(dòng)效果函數(shù)

關(guān)于這些緩動(dòng)函數(shù)的效果:cocoscreator2.x還提供了效果圖:

https://easings.net/cn

文檔說(shuō)明也很詳細(xì):https://docs.cocos.com/creator/2.3/api/zh/classes/Easing.html?h=easing

使用?easing?來(lái)使緩動(dòng)更生動(dòng),cc.tween?針對(duì)不同的情況提供了多種使用方式:

// 傳入easing名字,直接使用內(nèi)置easing函數(shù)

cc.tween().to(1, { scale: 2 }, {easing: 'sineOutIn'})

// 使用自定義easing函數(shù)

cc.tween().to(1, { scale: 2 }, {easing: t => t*t; })

// 只對(duì)單個(gè)屬性使用easing函數(shù)// value 必須與easing或者 progress 配合使用

cc.tween().to(1, { scale: 2, position: { value: cc.v3(100, 100, 100),easing: 'sineOutIn' } })

相對(duì)于?easing,自定義 progress 函數(shù)可以更自由的控制緩動(dòng)的過(guò)程:

// 對(duì)所有屬性自定義 progress

cc.tween().to(1, { scale: 2, rotation: 90 },?

{ ?

progress: (start, end, current, ratio) => { ? ?

????return start + (end - start) * ratio; ?

????}?

})


// 對(duì)單個(gè)屬性自定義 progress

cc.tween().to(1, { ?scale: 2, ?position: { ? ?

????value: cc.v3(), ? ?

????progress: (start, end, current, t) => { ? ? ?????????

????????return start.lerp(end, t, current); ? ?

????} ?

????}?

????}

)

// 注意,傳入的屬性為?cc.Vec3,所以需要使用 Vec3.lerp 進(jìn)行插值計(jì)算?


CocosCreator:常用于動(dòng)畫的緩動(dòng)類Easing的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
二连浩特市| 临西县| 巴楚县| 商河县| 吐鲁番市| 同江市| 永德县| 余庆县| 延庆县| 晋宁县| 延吉市| 荔波县| 突泉县| 高雄县| 鄂伦春自治旗| 大悟县| 聊城市| 澳门| 云和县| 寿宁县| 抚州市| 孟连| 呼图壁县| 正蓝旗| 庐江县| 德清县| 昆山市| 明光市| 内乡县| 莱阳市| 烟台市| 内江市| 东宁县| 英山县| 岑溪市| 潢川县| 辉南县| 九龙坡区| 赤壁市| 宜宾市| 饶阳县|