Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set opacity of chached image [5.0.1] #847

Closed
fervanrijswijk opened this issue Mar 10, 2014 · 9 comments
Closed

Set opacity of chached image [5.0.1] #847

fervanrijswijk opened this issue Mar 10, 2014 · 9 comments
Labels

Comments

@fervanrijswijk
Copy link

I have a hitspot image. When opacity is 1 it provides a stroke and a aplha fill as overlay for an existing image on the stage.

But, my starting position should be opacity 0, click on it and opacity should be 1.

When i try this example on the tutorial part is does not work either. Trying to set the lions opacity does not work for me. The monkey however, does accept the opacity.

Therefor the problem lies in the cached object... How can i solve this problem?

@lavrton
Copy link
Contributor

lavrton commented Mar 10, 2014

Currently you can't change opacity of cached node. You need clearCache before setting opacity. @ericdrowell look at #787 please. It is related with current issue.

@fervanrijswijk
Copy link
Author

Tahks for the reply,

But clearing the cache and setting the opacity to 0 will resolve into an non-clickable region because all pixels have 0 opacity.

@fervanrijswijk
Copy link
Author

Is it possible to manually replace the image data (stripped with opacity pixels)

@lavrton
Copy link
Contributor

lavrton commented Mar 10, 2014

You are using drawHitFromCache, right? You can:

  1. Create image with opacity 1
  2. Create hit
  3. only THEN set opacity to 0
    See demo: http://jsbin.com/yaqap/1/edit

@lavrton
Copy link
Contributor

lavrton commented Mar 10, 2014

Oh. Looks like it will not work in this way, because after clearCache hitFunc also cleared

@lavrton
Copy link
Contributor

lavrton commented Mar 10, 2014

You may use ultra hack: set opacity to 0.01 - invisible for you, but visiable for hit! http://jsbin.com/yaqap/2/edit

@fervanrijswijk
Copy link
Author

Thanks. I was experimenting with that already. I think i'll wait for the update. Nothing is broken yet.. :-)

@ericdrowell
Copy link
Owner

Ah, I think it makes sense for opacity to affect cached shapes. I'll fix this up.

@lavrton
Copy link
Contributor

lavrton commented May 15, 2014

fixed cb52be6

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

No branches or pull requests

3 participants