Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. /// Main area of interest, this function will
  2. /// return color for each particular color on our [ui.Image]
  3. int generatePixel(int x, int y, Size size) {
  4. var tiles = 5.0;
  5. var uv = Vector2(x / size.width, y / size.height);
  6. uv.y /= size.aspectRatio;
  7.  
  8. var gridUv = frac2(uv * tiles);
  9.  
  10. /// We have a square with top left and bottom right quarters
  11. /// painter with white and the rest being black.
  12. return (gridUv.x < .5 && gridUv.y < .5) || (gridUv.x > .5 && gridUv.y > .5)
  13. ? 0xffffffff
  14. : 0xff000000;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement