Anand Soni
Anand Soni

Reputation: 5110

Move Image on Button Click in Sencha touch 2

I wanted to move an image on button click. Like when i click on button , image should move from left to right . I was finding the x and y of image but failed to achieve goal. I have also tried with sliderfiled but suckes to change the default image of sliderfiled via sencha touch css. Can anybody help me?

Upvotes: 1

Views: 640

Answers (1)

Titouan de Bailleul
Titouan de Bailleul

Reputation: 12949

You can use Ext.Anim make an image move. Just define you animation like so

anim = Ext.create('Ext.Anim',{
  autoClear: false,
  from:{'left':'0px'}, // You can use CSS3 transforms for better performance
  to: {'left':'100px'},
  delay: 1000,
  duration: 1000
});

Then you can run this animation on any component. For example, if you have a reference to you image in a controller.

anim.run(this.getImage().element);

Hope this helps

Upvotes: 1

Related Questions