parameters: (animated, i)
return_statement: return Vector(pos[0], pos[1], animated.attrib["type"])
docstring: To convert the synfig coordinates from units(initially a string) to pixels
      Depends on whether a vector is provided to it or a real value
      If real value is provided, then time is also taken into consideration
  
      Args:
          animated (lxml.etree._Element) : Stores animation which contains waypoints
          i        (int)                 : Iterator over animation
  
      Returns:
          (common.Vector.Vector) If the animated type is not color
          (common.Color.Color)  Else if the animated type is color
docstring_summary: To convert the synfig coordinates from units(initially a string) to pixels
      Depends on whether a vector is provided to it or a real value
      If real value is provided, then time is also taken into consideration
docstring_tokens: To convert the synfig coordinates from units ( initially a string ) to pixels Depends on whether a vector is provided to it or a real value If real value is provided then time is also taken into consideration
function: def parse_position(animated, i):
      """
      To convert the synfig coordinates from units(initially a string) to pixels
      Depends on whether a vector is provided to it or a real value
      If real value is provided, then time is also taken into consideration
  
      Args:
          animated (lxml.etree._Element) : Stores animation which contains waypoints
          i        (int)                 : Iterator over animation
  
      Returns:
          (common.Vector.Vector) If the animated type is not color
          (common.Color.Color)  Else if the animated type is color
      """
      if animated.attrib["type"] == "vector":
          pos = [float(animated[i][0][0].text),
                 float(animated[i][0][1].text)]
          pos = [settings.PIX_PER_UNIT*x for x in pos]
  
      elif animated.attrib["type"] in {"real", "circle_radius"}:
          pos = parse_value(animated, i)
  
      elif animated.attrib["type"] == "angle":
          pos = [get_angle(float(animated[i][0].attrib["value"])),
                 get_frame(animated[i])]
  
      elif animated.attrib["type"] == "base":
          pos = [float(animated[i][0].attrib["value"])*settings.PIX_PER_UNIT,
                 get_frame(animated[i])]
  
      elif animated.attrib["type"] in {"composite_convert", "region_angle", "star_angle_new", "scalar_multiply"}:
          pos = [float(animated[i][0].attrib["value"]),
                 get_frame(animated[i])]
  
      elif animated.attrib["type"] == "rotate_layer_angle":
          # Angle needs to made neg of what they are
          pos = [-float(animated[i][0].attrib["value"]),
                 get_frame(animated[i])]
  
      elif animated.attrib["type"] == "opacity":
          pos = [float(animated[i][0].attrib["value"]) * settings.OPACITY_CONSTANT,
                 get_frame(animated[i])]
  
      elif animated.attrib["type"] == "effects_opacity":
          pos = [float(animated[i][0].attrib["value"]),
                 get_frame(animated[i])]
  
      elif animated.attrib["type"] == "points":
          pos = [int(animated[i][0].attrib["value"]) * settings.PIX_PER_UNIT,
                 get_frame(animated[i])]
  
      elif animated.attrib["type"] == "bool":
          val = animated[i][0].attrib["value"]
          if val == "false":
              val = 0
          else:
              val = 1
          pos = [val, get_frame(animated[i])]
  
      elif animated.attrib["type"] == "rectangle_size":
          pos = parse_value(animated, i)
          vec = Vector(pos[0], pos[1], animated.attrib["type"])
          vec.add_new_val(float(animated[i][0].attrib["value2"]) * settings.PIX_PER_UNIT)
          return vec
  
      elif animated.attrib["type"] == "image_scale":
          val = float(animated[i][0].attrib["value"])
          val2 = get_frame(animated[i])
          vec = Vector(val, val2, animated.attrib["type"])
          vec.add_new_val(float(animated[i][0].attrib["value2"]))
          return vec
  
      elif animated.attrib["type"] == "scale_layer_zoom":
          val = (math.e ** float(animated[i][0].attrib["value"])) * 100
          val2 = get_frame(animated[i])
          vec = Vector(val, val2, animated.attrib["type"])
          vec.add_new_val(val)
          return vec
  
      elif animated.attrib["type"] == "stretch_layer_scale":
          val1 = float(animated[i][0][0].text) * 100
          val3 = float(animated[i][0][1].text) * 100
          vec = Vector(val1, get_frame(animated[i]), animated.attrib["type"])
          vec.add_new_val(val3)
          return vec
  
      elif animated.attrib["type"] in {"group_layer_scale","blur_anim_x","blur_anim_y"}:
          if animated.attrib["type"] == "group_layer_scale":
              val1 = float(animated[i][0][0].text) * 100
              val3 = float(animated[i][0][1].text) * 100
              vec = Vector(val1, get_frame(animated[i]), animated.attrib["type"])
              vec.add_new_val(val3)
          elif animated.attrib["type"] == "blur_anim_x":
              val1 = float(animated[i][0][0].text) * 100
              vec = Vector(val1, get_frame(animated[i]), animated.attrib["type"])
          else:
              val1 = float(animated[i][0][1].text) * 100
              vec = Vector(val1, get_frame(animated[i]), animated.attrib["type"])
          return vec
  
      elif animated.attrib["type"] == "time":
          val = parse_time(animated[i][0].attrib["value"])    # Needed in seconds
          val2 = get_frame(animated[i])   # Needed in frames
          return Vector(val, val2, animated.attrib["type"])
  
      elif animated.attrib["type"] == "color":
          red = float(animated[i][0][0].text)
          green = float(animated[i][0][1].text)
          blue = float(animated[i][0][2].text)
          alpha = float(animated[i][0][3].text)
          red = red ** (1/settings.GAMMA[0])
          green = green ** (1/settings.GAMMA[1])
          blue = blue ** (1/settings.GAMMA[2])
          return Color(red, green, blue, alpha)
      
      elif animated.attrib["type"] == "gradient":
          return Gradient(animated[i][0])
  
      return Vector(pos[0], pos[1], animated.attrib["type"])
function_tokens: def parse_position ( animated , i ) : if animated . attrib [ "type" ] == "vector" : pos = [ float ( animated [ i ] [ 0 ] [ 0 ] . text ) , float ( animated [ i ] [ 0 ] [ 1 ] . text ) ] pos = [ settings . PIX_PER_UNIT * x for x in pos ] elif animated . attrib [ "type" ] in { "real" , "circle_radius" } : pos = parse_value ( animated , i ) elif animated . attrib [ "type" ] == "angle" : pos = [ get_angle ( float ( animated [ i ] [ 0 ] . attrib [ "value" ] ) ) , get_frame ( animated [ i ] ) ] elif animated . attrib [ "type" ] == "base" : pos = [ float ( animated [ i ] [ 0 ] . attrib [ "value" ] ) * settings . PIX_PER_UNIT , get_frame ( animated [ i ] ) ] elif animated . attrib [ "type" ] in { "composite_convert" , "region_angle" , "star_angle_new" , "scalar_multiply" } : pos = [ float ( animated [ i ] [ 0 ] . attrib [ "value" ] ) , get_frame ( animated [ i ] ) ] elif animated . attrib [ "type" ] == "rotate_layer_angle" : # Angle needs to made neg of what they are pos = [ - float ( animated [ i ] [ 0 ] . attrib [ "value" ] ) , get_frame ( animated [ i ] ) ] elif animated . attrib [ "type" ] == "opacity" : pos = [ float ( animated [ i ] [ 0 ] . attrib [ "value" ] ) * settings . OPACITY_CONSTANT , get_frame ( animated [ i ] ) ] elif animated . attrib [ "type" ] == "effects_opacity" : pos = [ float ( animated [ i ] [ 0 ] . attrib [ "value" ] ) , get_frame ( animated [ i ] ) ] elif animated . attrib [ "type" ] == "points" : pos = [ int ( animated [ i ] [ 0 ] . attrib [ "value" ] ) * settings . PIX_PER_UNIT , get_frame ( animated [ i ] ) ] elif animated . attrib [ "type" ] == "bool" : val = animated [ i ] [ 0 ] . attrib [ "value" ] if val == "false" : val = 0 else : val = 1 pos = [ val , get_frame ( animated [ i ] ) ] elif animated . attrib [ "type" ] == "rectangle_size" : pos = parse_value ( animated , i ) vec = Vector ( pos [ 0 ] , pos [ 1 ] , animated . attrib [ "type" ] ) vec . add_new_val ( float ( animated [ i ] [ 0 ] . attrib [ "value2" ] ) * settings . PIX_PER_UNIT ) return vec elif animated . attrib [ "type" ] == "image_scale" : val = float ( animated [ i ] [ 0 ] . attrib [ "value" ] ) val2 = get_frame ( animated [ i ] ) vec = Vector ( val , val2 , animated . attrib [ "type" ] ) vec . add_new_val ( float ( animated [ i ] [ 0 ] . attrib [ "value2" ] ) ) return vec elif animated . attrib [ "type" ] == "scale_layer_zoom" : val = ( math . e ** float ( animated [ i ] [ 0 ] . attrib [ "value" ] ) ) * 100 val2 = get_frame ( animated [ i ] ) vec = Vector ( val , val2 , animated . attrib [ "type" ] ) vec . add_new_val ( val ) return vec elif animated . attrib [ "type" ] == "stretch_layer_scale" : val1 = float ( animated [ i ] [ 0 ] [ 0 ] . text ) * 100 val3 = float ( animated [ i ] [ 0 ] [ 1 ] . text ) * 100 vec = Vector ( val1 , get_frame ( animated [ i ] ) , animated . attrib [ "type" ] ) vec . add_new_val ( val3 ) return vec elif animated . attrib [ "type" ] in { "group_layer_scale" , "blur_anim_x" , "blur_anim_y" } : if animated . attrib [ "type" ] == "group_layer_scale" : val1 = float ( animated [ i ] [ 0 ] [ 0 ] . text ) * 100 val3 = float ( animated [ i ] [ 0 ] [ 1 ] . text ) * 100 vec = Vector ( val1 , get_frame ( animated [ i ] ) , animated . attrib [ "type" ] ) vec . add_new_val ( val3 ) elif animated . attrib [ "type" ] == "blur_anim_x" : val1 = float ( animated [ i ] [ 0 ] [ 0 ] . text ) * 100 vec = Vector ( val1 , get_frame ( animated [ i ] ) , animated . attrib [ "type" ] ) else : val1 = float ( animated [ i ] [ 0 ] [ 1 ] . text ) * 100 vec = Vector ( val1 , get_frame ( animated [ i ] ) , animated . attrib [ "type" ] ) return vec elif animated . attrib [ "type" ] == "time" : val = parse_time ( animated [ i ] [ 0 ] . attrib [ "value" ] ) # Needed in seconds val2 = get_frame ( animated [ i ] ) # Needed in frames return Vector ( val , val2 , animated . attrib [ "type" ] ) elif animated . attrib [ "type" ] == "color" : red = float ( animated [ i ] [ 0 ] [ 0 ] . text ) green = float ( animated [ i ] [ 0 ] [ 1 ] . text ) blue = float ( animated [ i ] [ 0 ] [ 2 ] . text ) alpha = float ( animated [ i ] [ 0 ] [ 3 ] . text ) red = red ** ( 1 / settings . GAMMA [ 0 ] ) green = green ** ( 1 / settings . GAMMA [ 1 ] ) blue = blue ** ( 1 / settings . GAMMA [ 2 ] ) return Color ( red , green , blue , alpha ) elif animated . attrib [ "type" ] == "gradient" : return Gradient ( animated [ i ] [ 0 ] ) return Vector ( pos [ 0 ] , pos [ 1 ] , animated . attrib [ "type" ] )