Actuate alpha tween

Using the AddingAnimation sample project created with openfl command line.
As created, it does its 2 tweens without problem, one alpha and one scale.
However, if I comment out the second scale tween, and leave it to only do the alpha, it doesn’t do it.
Nothing shows up on screen.

What am I missing? If I only want to tween alpha and no other property, is it a special case and I need to do another check or anything?

Many thanks in advance.

package;

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import motion.easing.Elastic;
import motion.Actuate;
import openfl.Assets;

class Main extends Sprite {

public function new () {
    
    super ();
    
    var bitmap = new Bitmap (Assets.getBitmapData ("assets/openfl.png"));
    bitmap.x = - bitmap.width / 2;
    bitmap.y = - bitmap.height / 2;
    bitmap.smoothing = true;
    
    var container = new Sprite ();
    container.addChild (bitmap);
    container.alpha = 0;
    container.scaleX = 0;
    container.scaleY = 0;
    container.x = stage.stageWidth / 2;
    container.y = stage.stageHeight / 2;
    
    addChild (container);
    
    Actuate.tween (container, 3, { alpha: 1 } );
    //Actuate.tween (container, 4, { scaleX: 1, scaleY: 1 } ).delay (0.4).ease (Elastic.easeOut);
    
}

}

Okay, I just got it to work.

The first problem was that the container scaleX and scaleY are still being set to zero, commenting out those lines allows it to work on Flash.

The second is that the alpha tween occurs quickly, it also uses an exponential easing, which means most of the animation occurs during the first second or so, which might be while the window is still appearing. It is easier to see the effect if you add .delay (3) to the tween, or .ease (Linear.easeNone)

Awesome. Thank you very much.

Sorry if it was extremely simple but I don’t know how would I’ve gone around to catch it (other than traced the properties, but still left me clueless), so if you can hint me how did you catch it I’ll do some reading on my own to become more proficient.

Oh, it’s one of those little things you notice – often easier with a fresh set of eyes. Setting the scale to zero will obviously make it invisible, sometimes it helps to just go back to a “sane”, clean slate to figure this stuff out

IE, “can I create the bitmap and add it, is that visible?”, “if I set the alpha to zero (or .5) does it work as expected?”, “can I create a tween to change it, is there any chance the tween could be working, but I’m not seeing it?” so on :slight_smile:

1 Like