MCPcopy Create free account
hub / github.com/Jack-Cherish/python-spider / GetTransformStyles

Function GetTransformStyles

bilibili/xml2ass.py:327–346  ·  view source on GitHub ↗
(x=None, y=None, scale_x=None, scale_y=None, rotate_z=None, rotate_y=None, color=None, alpha=None)

Source from the content-addressed store, hash-verified

325 return AcfunPlayerSize[isHeight]*ZoomFactor[0]*InputPos*0.001+ZoomFactor[isHeight+1]
326
327 def GetTransformStyles(x=None, y=None, scale_x=None, scale_y=None, rotate_z=None, rotate_y=None, color=None, alpha=None):
328 styles = []
329 if x is not None and y is not None:
330 styles.append('\\pos(%s, %s)' % (x, y))
331 if scale_x is not None:
332 styles.append('\\fscx%s' % scale_x)
333 if scale_y is not None:
334 styles.append('\\fscy%s' % scale_y)
335 if rotate_z is not None and rotate_y is not None:
336 assert x is not None
337 assert y is not None
338 styles.append('\\frx%s\\fry%s\\frz%s\\fax%s\\fay%s' % ConvertFlashRotation(rotate_y, rotate_z, (x-ZoomFactor[1])/(width-ZoomFactor[1]*2), (y-ZoomFactor[2])/(height-ZoomFactor[2]*2)))
339 if color is not None:
340 styles.append('\\c&H%02X%02X%02X&' % (color & 0xff, (color >> 8) & 0xff, (color >> 16) & 0xff))
341 if color == 0x000000:
342 styles.append('\\3c&HFFFFFF&')
343 if alpha is not None:
344 alpha = 255-round(alpha*255)
345 styles.append('\\alpha&H%02X' % alpha)
346 return styles
347
348 def FlushCommentLine(f, text, styles, start_time, end_time, styleid):
349 if end_time > start_time:

Callers 2

Calls 1

ConvertFlashRotationFunction · 0.70

Tested by

no test coverage detected