Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
titchbb
Posts: 13
Registered: ‎09-20-2012
My Device: BlackBerry 10 Dev Alpha
My Carrier: n/a

Playing an explicit animation on a Container after changing imageSource of ImageView.

Hi,

 

I have a container with an ImageView that has an explicit animation.

 

import bb.cascades 1.0

Container {
  property int delay: 100

  layout: DockLayout {}

  animations: [
    ScaleTransition {
      id: anim
      fromX: 0
      toX: 1
      fromY: 0
      toY: 1
      duration: delay
      easingCurve: StockCurve.QuadraticOut
    }
  ]

  ImageView {
    id: image
  }

  function foo() {
    image.imageSource = "asset:///img/myImage.png";
    anim.play();
  }
}

 When the function foo is called, I want to change the image and play the scale-in animation.

 

How do I prevent the implicit animation resulting from changing the imageSource playing, or is this done automatically because I have declared an explicit animation?

 

It appears to work correctly, but I'm not sure if the implicit animation is running for a short time before the explicit animation kicks in.

 

I've seen that implicit animations can be disabled using an ImplicitAnimationController, but which animations from the list of controllable animations should be disabled, and on which component?

 

I've tried disabling all implicit animations on the ImageView using the code below, but when I comment out my explicit animation, there appears to be an implicit animation still playing.

 

    ImageView {
    id: image
    horizontalAlignment: HorizontalAlignment.Center
    verticalAlignment: VerticalAlignment.Center

        attachedObjects: [
            ImplicitAnimationController {
                enabled: false
            }
        ]
    }

 Many thanks

 

Please use plain text.