nipapin

Expression | Rotate Image

Oct 13th, 2019 (edited)
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sourceWidth = width/2;
  2. sourceHeight = height/2;
  3. diagonal = Math.sqrt(sourceWidth * sourceWidth + sourceHeight * sourceHeight);
  4. sinB = sourceWidth/diagonal;
  5. sourceRotation = Math.abs(rotation.value);
  6. a0 = radiansToDegrees(Math.asin(sinB));
  7. a1 = a0 - sourceRotation;
  8. x = sourceWidth - sourceHeight * Math.tan(degreesToRadians(a1));
  9. ratio = width/(width + x*2);
  10. value / (ratio)
Add Comment
Please, Sign In to add comment