static void InitGradientArrays( LinearGradientBrush brush, out Avm.Array colors, out Avm.Array alphas, out Avm.Array ratios) { colors = new Avm.Array(); alphas = new Avm.Array(); ratios = new Avm.Array(); var cb = brush.InterpolationColors; if (cb != null) { int n = cb.Colors.Length; for (int i = 0; i < n; ++i) { var c = cb.Colors[i]; AddColor(colors, alphas, c); ratios.push((uint)(cb.Positions[i] * 255)); } } else { var c1 = brush.LinearColors[0]; var c2 = brush.LinearColors[1]; AddColor(colors, alphas, c1); AddColor(colors, alphas, c2); ratios.push(0); ratios.push(255); } }
public AnimationScene() { mTransitions = new Array(Transitions.LINEAR, Transitions.EASE_IN_OUT, Transitions.EASE_OUT_BACK, Transitions.EASE_OUT_BOUNCE, Transitions.EASE_OUT_ELASTIC); var buttonTexture = Game.assets.getTexture("button_normal"); // create a button that starts the tween mStartButton = new Button(buttonTexture, "Start animation"); mStartButton.triggered += onStartButtonTriggered; mStartButton.x = Constants.CenterX - (int)(mStartButton.width / 2); mStartButton.y = 20; addChild(mStartButton); // this button will show you how to call a method with a delay mDelayButton = new Button(buttonTexture, "Delayed call"); mDelayButton.triggered += onDelayButtonTriggered; mDelayButton.x = mStartButton.x; mDelayButton.y = mStartButton.y + 40; addChild(mDelayButton); // the Starling will be tweened mEgg = new Image(Game.assets.getTexture("starling_front")); addChild(mEgg); resetEgg(); mTransitionLabel = new TextField(320, 30, "", "Verdana", 20, 0, true); mTransitionLabel.y = mDelayButton.y + 40; mTransitionLabel.alpha = 0.0; // invisible, will be shown later addChild(mTransitionLabel); }
static void AddColor(Avm.Array colors, Avm.Array alphas, Color c) { colors.push(ColorHelper.ToFlash(c)); alphas.push(c.A / 255.0); }