1 Bug(?) with wade.setLayerOpacity
Hello!
I experimented with different layers with aim to create clouds and ground system on pseudo-isometric (iso without wade iso plugin)
I need show clouds only when map is zoom-out (small ground) and hide clouds when zoom-in (large ground)
I separate cloud and ground on 2 layers and use wade.setLayerOpacity (layerId, opacity) on zoom change
And i found problem
I save camera position to move behind scenes, and because i must set opacity in depend of saved camera position i use wade.setLayerOpacity(layerId, 0) on start map scene - but it not work!
To recreate this just create 2 layers 1 and 2 and write in console wade.setLayerOpacity(1 , 0)
I dont understand why, but if change 0 to 0.00001 (any non-zero less number) - it start working
2 Q - How freeze layer transform in one side?
I need show clouds only when zoom has large scale, and clouds need transforms too - wade.setLayerTransform (layerId, 0, translate) - no option for me
But i cant recreate logic of cloud layer with wade wade.setLayerTransform function
I need something like https://en.wikipedia.org/wiki/Angular_diameter - because i need create illusion walk over the clouds - if camera.z = max - layer scale must be -10 (as example)
I dont know how mariage angular diameter and scale layer
Now in project i use
wade.setLayerOpacity(14, Math.max(0,cameraPos.z*cameraPos.z-2.25));
wade.setLayerTransform(14, cameraPos.z*cameraPos.z - 6, 1);
Just fade clouds faster than they grow/small
or another less-smooth version:
var scale = (cameraPos.z>1.5) ? .99 : -.99;
And another problem i found - scale == -1 cause error:
Warning: it isn't possible to render this frame
I think there a small bug in this functions with zero(ceil?) variables
And may be i found answer:)
3 Another one
There is wade.mouseIn and mouseOut events but sometimes in not work properly if object is moving. It because js no triggers when mouse dont move, but object is still move!
Wade can make it work:
obj.onUpdate= function(){
if(!this.getSprite(0).containsScreenPoint(wade.getMousePosition())){
if(this.hovered) {
this.hovered=false;
this.getSprite(1).fadeIn(0,null);
}
} else if(this.getSprite(0).containsScreenPoint(wade.getMousePosition())){
if(!this.hovered) {
this.hovered=true;
this.getSprite(1).fadeOut(0,null);
}
}
}
But it seems so expensive! May be another way WADE-in-box exist?
4 Another thing
Please make more acessible editor.I speak about font size in code editor - may be it make a little bit larger? or custom for users?