浏览代码

update by delta time

/main
siyao 4 年前
当前提交
66996229
共有 2 个文件被更改,包括 2 次插入13 次删除
  1. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Script/ImageTest.cs
  2. 4
      com.unity.uiwidgets/Runtime/widgets/LottiePainter.cs

11
Samples/UIWidgetsSamples_2019_4/Assets/Script/ImageTest.cs


class ExampleState : State<ExampleApp>
{
private float frame = 0;
public override Widget build(BuildContext context)
{
return new Container(

child: Image.network(
"https://unity-cn-cms-prd-1254078910.cos.ap-shanghai.myqcloud.com/assetstore-cms-media/img-7dfe215f-0075-4f9c-9b5a-be5ee88b866b",
gaplessPlayback: true)
),
new GestureDetector(
onTap: () => { setState(() => { frame += 1; }); },
child: new Container(
color: Color.black,
padding: EdgeInsets.symmetric(20, 20),
child: new Text("Click Me",
style: new TextStyle(fontWeight: FontWeight.w700))
)
)
}
)

4
com.unity.uiwidgets/Runtime/widgets/LottiePainter.cs


if (_round != 0) {
WidgetsBinding.instance.addPostFrameCallback((_) => {
setState(() => {
_frame += 0.01f;
_frame += Time.deltaTime;
_frame = 0;
_frame -= widget._duration;
if (_round > 0) {
_round--;
}

正在加载...
取消
保存