Advertisement
Guest User

Untitled

a guest
May 30th, 2014
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Algorithms for SVG Horizontal, Vertical and HorizontalVertical Flip
  2.  
  3. NORMAL:
  4. -------
  5.  
  6. translate=(-(CENTER_X*(SCALE_X-1)),-(CENTER_Y*(SCALE_Y-1))
  7. scale=(SCALE_X, SCALE_Y)
  8. translate(MOVE_X,MOVE_Y)
  9. rotate=(DEGREES, CENTER_X, CENTER_Y)
  10.  
  11.  
  12. VERTICAL MIRROR:
  13. ----------------
  14.  
  15. translate=(SCREEN_WIDTH+(CENTER_X*(SCALE_X-1)), (SCALE_X-1)*CENTER_Y)
  16. scale=(SCALE_X, SCALE_Y)
  17. scale="-1, 1"
  18. translate(MOVE_X, MOVE_Y)
  19. rotate(DEGREES, CENTER_X, CENTER_Y)
  20.  
  21. http://jsfiddle.net/t46pU/
  22.  
  23.  
  24. HORIZONTAL MIRROR:
  25. ------------------
  26.  
  27. translate=-((SCALE_X-1)*CENTER_X), (SCREEN_HEIGHT+((SCALE_Y-1)*CENTER_Y)
  28. scale=(SCALE_X, SCALE_Y)
  29. scale="1, -1"
  30. translate(MOVE_X, MOVE_Y)
  31. rotate=(DEGREES, CENTER_X, CENTER_Y)
  32.  
  33. http://jsfiddle.net/RxG7z/
  34.  
  35. BOTH MIRRORS:
  36. -------------
  37.  
  38. translate=(SCREEN_WIDTH+((SCALE_X-1)*CENTER_X), (SCREEN_HEIGHT+((SCALE_Y-1)*CENTER_Y))
  39. scale=(SCALE_X, SCALE_Y)
  40. scale=(-1, -1)
  41. translate(MOVE_X, MOVE_Y)
  42. rotate(DEGREES, CENTER_X, CENTER_Y)
  43.  
  44. http://jsfiddle.net/funH3/
  45.  
  46. ---------
  47.  
  48. When no mirror is used:
  49. -----------------------
  50. Normal algorithm is added
  51.  
  52. When vertical mirror is used:
  53. -----------------------------
  54. Normal algorithm is added (first SVG object)
  55. Vertical algorithm is added (second SVG object)
  56.  
  57. When horizontal mirror is used:
  58. -------------------------------
  59. Normal algorithm is added (first SVG object)
  60. Horizontal algorithm is added (second SVG object)
  61.  
  62. When horizontal and vertical mirror is used:
  63. --------------------------------------------
  64. Normal algorithm is added (first SVG object)
  65. Vertical algorithm is added (second SVG object)
  66. Horizontal algorithm is added (third SVG object)
  67. Both Mirrors algorithm is added (fourth object)
  68.  
  69. This last ones, makes sure that whatever you draw in one corner appears in all the rest corners.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement