Titanium 在appcelerator中为图像视图实现暂停和重新启动动画

Titanium 在appcelerator中为图像视图实现暂停和重新启动动画,titanium,appcelerator,titanium-mobile,appcelerator-titanium,titanium-alloy,Titanium,Appcelerator,Titanium Mobile,Appcelerator Titanium,Titanium Alloy,我有一个图像,它一直在上下方向动画。单击图像时,图像应暂停动画制作,再次单击图像应恢复动画制作。 我现在正在使用图像视图的pause(),但它没有任何作用。它提到“如果指定了多个图像,则此方法有效”,但如何对单个图像使用此方法。 请在下面的链接中找到代码。多谢各位 index.xml: <Alloy> <Window id="winIos"> <View id="vOne" class='viewSize'> <ImageView

我有一个图像,它一直在上下方向动画。单击图像时,图像应暂停动画制作,再次单击图像应恢复动画制作。 我现在正在使用图像视图的pause(),但它没有任何作用。它提到“如果指定了多个图像,则此方法有效”,但如何对单个图像使用此方法。 请在下面的链接中找到代码。多谢各位

index.xml:

<Alloy>
  <Window id="winIos">
    <View id="vOne" class='viewSize'>
      <ImageView id="one" class='oval' ></ImageView>
      <ImageView id="a" image= "/images/img_1.png"></ImageView>
    </View>
  </Window>
</Alloy>
index.tss

"#winIos":{
    orientationModes:[Ti.UI.LANDSCAPE_RIGHT],
    backgroundColor:'white',
    id2:""
}

".viewSize":{
    height:150,
    width:150,
}

".oval":{
    image:'/images/oval.png',
    height:"50", 
    width:"150",  
    left:"0", 
    bottom:"-2", 
    touchEnabled:"false"
}

"#a":{
    id2:'',
    height:100,
    width:70,
    top:149,
    touchEnabled:false,
}

"#vOne":{
    id2:'',
    left:"80", 
    touchEnabled:false,
    top:"10",
    zIndex:0
}
ImageView
pause()
仅适用于您提到的多个图像。这是一个图像幻灯片,它与
Ti.UI.Animation
无关。实际上,您无法在Android上停止动画,但在实现
stop()
时有一个开放的PR()

根据您的动画,您可以尝试创建一个Lottie动画并使用Ti.animation(),因为它包括暂停和恢复方法

"#winIos":{
    orientationModes:[Ti.UI.LANDSCAPE_RIGHT],
    backgroundColor:'white',
    id2:""
}

".viewSize":{
    height:150,
    width:150,
}

".oval":{
    image:'/images/oval.png',
    height:"50", 
    width:"150",  
    left:"0", 
    bottom:"-2", 
    touchEnabled:"false"
}

"#a":{
    id2:'',
    height:100,
    width:70,
    top:149,
    touchEnabled:false,
}

"#vOne":{
    id2:'',
    left:"80", 
    touchEnabled:false,
    top:"10",
    zIndex:0
}