Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

AlphaBehavior on an ActorContainer does not affect children #122

Closed
arnuschky opened this issue Feb 5, 2013 · 2 comments
Closed

AlphaBehavior on an ActorContainer does not affect children #122

arnuschky opened this issue Feb 5, 2013 · 2 comments

Comments

@arnuschky
Copy link

The code below does not fade in the children of the actor container. Instead, they appear on screen right away. Expected would be that the container and its children fade in together.

If I change the behavior to another one, ie a RotateBehavior, the code works as expected (and as described in the documentation): the behavior rotates the container and all its children.

            var background = (new CAAT.Actor()).
               setBackgroundImage("background", true).
               setScale(.8, .6);

            var someimage = (new CAAT.Actor()).
               setBackgroundImage("someimage", true);

            var container = (new CAAT.ActorContainer()).
               setSize(background.width, background.height).
               centerAt(director.width / 2.0, director.height / 2.0).
               enableEvents(false).
               addBehavior((new CAAT.AlphaBehavior()).
                  setValues(0, 1).
                  setFrameTime(scene.time, 3000).
                  setInterpolator((new CAAT.Interpolator).
                     createExponentialInInterpolator(6, false)));

            container.addChild(background);
            container.addChild(someimage);
@hyperandroid
Copy link
Owner

Alpha has two different ways of application:

  • not affecting children (default)
  • affect all children: call setGlobalAlpha(bool) on the container to enable
    it.
  • ibon

2013/2/5 arnuschky notifications@github.com

The code below does not fade in the children of the actor container.
Instead, they appear on screen right away. Expected would be that the
container and its children fade in together.

If I change the behavior to another one, ie a RotateBehavior, the code
works as expected (and as described in the documentation): the behavior
rotates the container and all its children.

        var background = (new CAAT.Actor()).
           setBackgroundImage("background", true).
           setScale(.8, .6);

        var someimage = (new CAAT.Actor()).
           setBackgroundImage("someimage", true);

        var container = (new CAAT.ActorContainer()).
           setSize(background.width, background.height).
           centerAt(director.width / 2.0, director.height / 2.0).
           enableEvents(false).
           addBehavior((new CAAT.AlphaBehavior()).
              setValues(0, 1).
              setFrameTime(scene.time, 3000).
              setInterpolator((new CAAT.Interpolator).
                 createExponentialInInterpolator(6, false)));

        container.addChild(background);
        container.addChild(someimage);


Reply to this email directly or view it on GitHubhttps://github.com//issues/122..

@arnuschky
Copy link
Author

OK, great, that explains it. Must have missed that when I was browsing
the code.

Thanks a bunch
Arne

On Tue, 05 Feb 2013 11:08:48 -0800 Ibon Tolosana
notifications@github.com wrote:

Alpha has two different ways of application:

  • not affecting children (default)
  • affect all children: call setGlobalAlpha(bool) on the container to
    enable it.
  • ibon

2013/2/5 arnuschky notifications@github.com

The code below does not fade in the children of the actor container.
Instead, they appear on screen right away. Expected would be that
the container and its children fade in together.

If I change the behavior to another one, ie a RotateBehavior, the
code works as expected (and as described in the documentation): the
behavior rotates the container and all its children.

        var background = (new CAAT.Actor()).
           setBackgroundImage("background", true).
           setScale(.8, .6);

        var someimage = (new CAAT.Actor()).
           setBackgroundImage("someimage", true);

        var container = (new CAAT.ActorContainer()).
           setSize(background.width, background.height).
           centerAt(director.width / 2.0, director.height /

2.0). enableEvents(false).
addBehavior((new CAAT.AlphaBehavior()).
setValues(0, 1).
setFrameTime(scene.time, 3000).
setInterpolator((new CAAT.Interpolator).
createExponentialInInterpolator(6, false)));

        container.addChild(background);
        container.addChild(someimage);


Reply to this email directly or view it on
GitHubhttps://github.com//issues/122..


Reply to this email directly or view it on GitHub:
#122 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants