cc.opacityBy? | Help!

image

Is there any reason you don’t look in the API-Ref?

I found this
image

but didnt work

That creates a color object. That’s a start.

But if i used var action = cc.Color(255, 0, 0, 100); It should work and lower the opacity or not?

nope, you are just creating a color object. You need to apply that color to the object you want. Perhaps look at tintBy() or tintTo()

Alrighty, can i use tintTo(255,255,255,0) to change the opacity? I mean if I then run the action on a node

seems appropriate

Tinting sprites does not change the opacity. To change the opacity of the object use the cc.fadeTo(time, opacity) action.

var fadeAction = cc.fadeTo(0.2, 0)

If you want to change opacity to 255 or 0 you can use the cc.fadeIn and cc.fadeOut actions.

I was trying to get the OP to use the API ref and see for themselves what was available. They would have replied that tintBy isn’t right.

That worked perfectly, really appreciate it!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.