
Ă\c           @  s  d  d l  m Z d  d l Td  d l Z d  d l Z d  d l m Z d  d l m	 Z	 d e	 f d     YZ
 d e f d	     YZ d e e e d
 d d  Z d e e e d
 d d  Z d e f d     YZ d d d d  Z d   Z d e j j j f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e j j j f d     YZ e e j j _ e e j j _ e e j j _ e e j j _ e e j j _ e e j j _ e
 e j j _
 e e j j _ e e j j _ e e j j _ e e j j _ d S(   i(   t   print_function(   t   *N(   t   render(   t	   Containert   Motionc           B  sS   e  Z d  Z d d d e e d e d d e d d  Z d   Z d   Z d   Z RS(   s  
    This is used to move a child displayable around the screen. It
    works by supplying a time value to a user-supplied function,
    which is in turn expected to return a pair giving the x and y
    location of the upper-left-hand corner of the child, or a
    4-tuple giving that and the xanchor and yanchor of the child.

    The time value is a floating point number that ranges from 0 to
    1. If repeat is True, then the motion repeats every period
    sections. (Otherwise, it stops.) If bounce is true, the
    time value varies from 0 to 1 to 0 again.

    The function supplied needs to be pickleable, which means it needs
    to be defined as a name in an init block. It cannot be a lambda or
    anonymous inner function. If you can get away with using Pan or
    Move, use them instead.

    Please note that floats and ints are interpreted as for xpos and
    ypos, with floats being considered fractions of the screen.
    t   motionc         K  s   | d k r | } n  | d k r1 | r1 | } n  t t |   j d | |  | d k	 ri |  j |  n  | |  _ | |  _ | |  _ | |  _ | |  _	 |	 |  _
 | |  _ | |  _ d |  _ d S(   s  
        @param child: The child displayable.

        @param new_widget: If child is None, it is set to new_widget,
        so that we can speak the transition protocol.

        @param old_widget: Ignored, for compatibility with the transition protocol.

        @param function: A function that takes a floating point value and returns
        an xpos, ypos tuple.

        @param period: The amount of time it takes to go through one cycle, in seconds.

        @param repeat: Should we repeat after a period is up?

        @param bounce: Should we bounce?

        @param delay: How long this motion should take. If repeat is None, defaults to period.

        @param anim_timebase: If True, use the animation timebase rather than the shown timebase.

        @param time_warp: If not None, this is a function that takes a
        fraction of the period (between 0.0 and 1.0), and returns a
        new fraction of the period. Use this to warp time, applying
        acceleration and deceleration to motions.

        This can also be used as a transition. When used as a
        transition, the motion is applied to the new_widget for delay
        seconds.
        t   styleN(   t   Nonet   superR   t   __init__t   addt   functiont   periodt   repeatt   bouncet   delayt   anim_timebaset	   time_warpt	   add_sizest   position(   t   selfR   R   t   childt
   new_widgett
   old_widgetR   R   R   R   t	   tag_startR   R   R   t
   properties(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR	   ;   s      										c         C  s  t  j j rF |  j r: |  j } |  j rC | |  j } qC q |  j } n |  j r | |  j k r |  j } |  j r | |  j } q n` |  j r | |  j } t  j j j |  d  n1 | |  j k r |  j } n t  j j j |  d  |  j d k r| |  j :} n d } |  j	 r#|  j	 |  } n  |  j
 rR| d } | d k rRd | } qRn  |  j rp|  j | |  } n |  j |  } t |  } t |  d k r| |  j j pd |  j j pd f |  _ n	 | |  _ d  S(   Ni    i   i   g      ?g       @(   t   renpyt   gamet   less_updatesR   R   R   t   displayR   t   redrawR   R   R   R   t   tuplet   lenR   t   xanchort   yanchorR   (   R   t   tt   sizest   res(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyt   update_positionq   s@    								
	.c         C  sd   |  j  d  k r> |  j r+ t t |   j   S|  j d d   n  |  j  |  j j |  j j	 |  j j
 f S(   Ng        (   R   R   R   R   R   t   get_placementR&   R   t   xoffsett   yoffsett   subpixel(   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR'      s
    	c   
      C  s   |  j  r | } n | } t |  j | | | |  } | j   \ } } |  j | | | | | f  t j j j | |  }	 |	 j | d  d g |  _	 |	 S(   Ni    (   i    i    (   i    i    (
   R   R   R   t   get_sizeR&   R   R   t   Rendert   blitt   offsets(
   R   t   widtht   heightt   stt   atR#   R   t   cwt   cht   rv(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR      s    		N(	   t   __name__t
   __module__t   __doc__R   t   FalseR	   R&   R'   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR   %   s
   *6	/	t   Interpolatec           B  sF   e  Z i d  d 6d d 6d d 6d  d 6d d 6Z d   Z d d	  Z RS(   g        t   topg      ?t   centerg      ?t   bottomt   leftt   rightc         C  s   t  |  t  |  k r' t d   n  g  | D] } |  j j | |  ^ q. |  _ g  | D] } |  j j | |  ^ qY |  _ d  S(   Ns9   The start and end must have the same number of arguments.(   R    t	   Exceptiont   anchorst   gett   startt   end(   R   RC   RD   t   i(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR	      s    +c         C  sG   t  j j f t |  j  } t  j j | t |  j  t |  j  |  S(   N(   R   t   atlR   R    RC   t   interpolateR   RD   (   R   R#   R$   t   types(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyt   __call__   s    N(   NNNN(   R6   R7   RA   R	   R   RI   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR:      s   
	R   c	         K  sb   |  \ }
 } | \ } } t  t |
 | f | | f  | | d | d | d | d | d | |	 S(   s  
    This is used to pan over a child displayable, which is almost
    always an image. It works by interpolating the placement of the
    upper-left corner of the screen, over time. It's only really
    suitable for use with images that are larger than the screen,
    and we don't do any cropping on the image.

    @param startpos: The initial coordinates of the upper-left
    corner of the screen, relative to the image.

    @param endpos: The coordinates of the upper-left corner of the
    screen, relative to the image, after time has elapsed.

    @param time: The time it takes to pan from startpos to endpos.

    @param child: The child displayable.

    @param repeat: True if we should repeat this forever.

    @param bounce: True if we should bounce from the start to the end
    to the start.

    @param anim_timebase: True if we use the animation timebase, False to use the
    displayable timebase.

    @param time_warp: If not None, this is a function that takes a
    fraction of the period (between 0.0 and 1.0), and returns a
    new fraction of the period. Use this to warp time, applying
    acceleration and deceleration to motions.

    This can be used as a transition. See Motion for details.
    R   R   R   R   R   (   R   R:   (   t   startpost   endpost   timeR   R   R   R   R   R   R   t   x0t   y0t   x1t   y1(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyt   Pan   s    #c	   
      K  s:   t  t |  |  | | d | d | d | d | d | |	 S(   s  
    This is used to pan over a child displayable relative to
    the containing area. It works by interpolating the placement of the
    the child, over time.

    @param startpos: The initial coordinates of the child
    relative to the containing area.

    @param endpos: The coordinates of the child at the end of the
    move.

    @param time: The time it takes to move from startpos to endpos.

    @param child: The child displayable.

    @param repeat: True if we should repeat this forever.

    @param bounce: True if we should bounce from the start to the end
    to the start.

    @param anim_timebase: True if we use the animation timebase, False to use the
    displayable timebase.

    @param time_warp: If not None, this is a function that takes a
    fraction of the period (between 0.0 and 1.0), and returns a
    new fraction of the period. Use this to warp time, applying
    acceleration and deceleration to motions.

    This can be used as a transition. See Motion for details.
    R   R   R   R   R   (   R   R:   (
   RJ   RK   RL   R   R   R   R   R   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyt   Move	  s    !t   Revolverc           B  s#   e  Z d d d d  Z d   Z RS(   g      ?c         C  s:   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   N(   RC   RD   t   aroundt   cort   posR   (   R   RC   RD   R   RT   RU   RV   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR	   7  s    					c         C  s  | \ } } } } d   } |  j  d  k r< |  j j   } n	 |  j  } | \ }	 }
 } } } } } | |	 |  }	 | |
 |  }
 | | |  } | | |  } |  j \ } } | | |  } | | |  } |  j \ } } | | |  } | | |  } |  j |  j |  j | } | t j	 d 9} |	 | | | } |
 | | | } | t j
 |  | t j |  } | t j |  | t j
 |  } | | | } | | | } t j j j |  t j j j |  d d f S(   Nc         S  s:   |  d  k r d }  n  t |  t  r2 t |  |  S|  Sd  S(   Ni    (   R   t
   isinstancet   floatt   int(   t   xt   r(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyt   ftiE  s
    	i   i    (   RV   R   R   R'   RT   RU   RC   RD   t   matht   pit   cost   sinR   R   t   coret   absolute(   R   R#   t   rectt   wt   hR3   R4   R\   RV   t   xpost   yposR!   R"   t   _xoffsett   _yoffsett	   _subpixelt   xaroundt   yaroundt   xcort   ycort   angleRZ   t   yt   nxt   ny(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyRI   ?  s2    			$$(   g      ?g      ?(   g      ?g      ?N(   R6   R7   R   R	   RI   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyRS   5  s   g      ?c         K  s7   t  t |  | | d | d | d | | | d t | S(   NRT   RU   RV   R   (   R   RS   t   True(   RC   RD   RL   R   RT   RU   RV   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyt   Revolvev  s
    $c   	      C  s   t  j j j | |  } | d k sH | d k sH | d k sH | d k rL | St  j j j | | d d | |  | _ t  j j j | | d d | |  | _ t | _ t | _	 | j
 |  | j j | |   | S(   s  
    This creates a render that zooms its child.

    `crend` - The render of the child.
    `x`, `y`, `w`, `h` - A rectangle inside the child.
    `zw`, `zh` - The size the rectangle is rendered to.
    `bilinear` - Should we be rendering in bilinear mode?
    i    (   R   R   R   R,   t   Matrix2Dt   forwardt   reverseRs   t	   xclippingt	   yclippingR-   t	   transform(	   t   crendRZ   Rp   Rd   Re   t   zwt   zht   bilinearR5   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyt   zoom_render  s    
0))		!t
   ZoomCommonc        	   B  sD   e  Z e d d e e e e d  d  Z d   Z d   Z d   Z RS(   R   c         K  s   t  t |   j d |
 |  t j j |  } | |  _ | |  _ |	 |  _ | rg t j j |  |  _	 n | ry | |  _	 n	 d |  _	 | |  _ | |  _ | |  _ | |  _ d S(   s}  
        @param time: The amount of time it will take to
        interpolate from the start to the end rectange.

        @param child: The child displayable.

        @param after_child: If present, a second child
        widget. This displayable will be rendered after the zoom
        completes. Use this to snap to a sharp displayable after
        the zoom is done.

        @param time_warp: If not None, this is a function that takes a
        fraction of the period (between 0.0 and 1.0), and returns a
        new fraction of the period. Use this to warp time, applying
        acceleration and deceleration to motions.
        R   N(   R   R   R	   R   t   easyt   displayableRL   R   R   t   after_childR   R   R~   t   opaqueR   (   R   RL   R   t   end_identityR   R   R~   R   R   R   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR	     s    							c         C  s   |  j  |  j g S(   N(   R   R   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyt   visit  s    c      	   C  s  |  j  r | } n | } |  j r: t | |  j d  } n d } |  j rV | d } n  t j j rk d } n  | |  _ |  j r | d k r t j	 j
 j
 |  j | | | |  S|  j r |  j |  } n  t j	 j
 j
 |  j | | | |  } |  j | | j | j  \ } }	 }
 } } } | d k  sU|	 d k  sU| |
 | j k sU|	 | | j k rt d | |	 |
 | f | j | j f   n  t | | |	 |
 | | | |  j  } |  j d k  rt j	 j
 j |  d  n  | S(   Ng      ?i    s8   Zoom rectangle %r falls outside of %dx%d parent surface.(   R   RL   t   minR   R   R   R   t   doneR   R   R   R   R   t   zoom_rectangleR/   R0   R@   R   R~   R   (   R   R/   R0   R1   R2   R#   R   t   rendt   rxt   ryt   rwt   rhR|   R}   R5   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR     s.    						"	$->.$c         C  s^   |  j  s d } n t | |  j  d  } | d k rV |  j rV |  j j | | | |  Sd  Sd  S(   Ng      ?(   RL   R   R   t   eventR   (   R   t   evRZ   Rp   R1   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR     s    		N(	   R6   R7   R9   R   Rs   R	   R   R   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR     s   (		(t   Zoomc           B  s   e  Z d    Z d   Z RS(   c         K  sQ   | d | k } t  t |   j | | d | | | |  _ | |  _ | |  _ d  S(   Ng        R   (   g        g        (   R   R   R	   t   sizeRC   RD   (   R   R   RC   RD   RL   R   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR	     s
    "		c   
      C  sj   g  t  |  j |  j  D] \ } } | | | | ^ q \ } } } }	 | | | |	 |  j d |  j d f S(   Ni    i   (   t   zipRC   RD   R   (
   R   R   R/   R0   t   at   bR   R   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR     s    F(   R6   R7   R	   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR     s   	
t
   FactorZoomc           B  s   e  Z d    Z d   Z RS(   c         K  sD   | d k } t  t |   j | | d | | | |  _ | |  _ d  S(   Ng      ?R   (   R   R   R	   RC   RD   (   R   RC   RD   RL   R   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR	     s    "	c         C  s9   |  j  |  j |  j  | } d d | | | | | | f S(   Ni    (   RC   RD   (   R   R   R/   R0   t   factor(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR   "  s    (   R6   R7   R	   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR     s   		t   SizeZoomc           B  s   e  Z d    Z d   Z RS(   c         K  s>   t  } t t |   j | | d | | | |  _ | |  _ d  S(   NR   (   R9   R   R   R	   RC   RD   (   R   RC   RD   RL   R   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR	   +  s    "	c   
      C  sX   |  j  \ } } |  j \ } } | | | | } | | | | }	 d d | | | |	 f S(   Ni    (   RC   RD   (
   R   R   R/   R0   t   swt   sht   ewt   ehR|   R}   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR   4  s
    (   R6   R7   R	   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR   )  s   		t   RotoZoomc           B  sG   e  Z d Z e e e e e e d d e d  d 
 Z d   Z d   Z RS(   R   c         K  s   t  t |   j d | |  | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ t	 j
 j |  |  _ | |  _ |	 |  _ |
 |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   NR   (   R   R   R	   t	   rot_startt   rot_endt	   rot_delayt
   zoom_startt   zoom_endt
   zoom_delayR   R   R   R   t
   rot_repeatt   zoom_repeatt
   rot_bouncet   zoom_bouncet   rot_anim_timebaset   zoom_anim_timebaset   rot_time_warpt   zoom_time_warpR   (   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR	   C  s"    														c         C  s
   |  j  g S(   N(   R   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR   q  s    c   
      C  sL  |  j  r | } n | } |  j r* | } n | } |  j d k rH d } n | |  j :} |  j d k rm d } n | |  j :} |  j r | d ;} n  |  j r | d ;} n  |  j r | d 9} t | d |  } n  |  j r | d 9} t | d |  } n  t	 j
 j rd } d } n  t | d  } t | d  } |  j rL|  j |  } n  |  j rg|  j |  } n  |  j d |  j |  j | } |  j d |  j |  j | } t | d  } |  j d  k rt |  j  |  _ n  | |  j _ | |  j _ t	 j j j |  j | | | |  }	 | d k s,| d k rHt	 j j j |  j d  n  |	 S(   Ni    g      ?i   g       @gMbP?(   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   maxRz   R   t	   TransformR   t   rotatet   zoomR   R   R   (
   R   R/   R0   R1   R2   t   rot_timet	   zoom_timeRo   R   R5   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR   t  sT    									
	
			$N(   R6   R7   R   Rz   R9   R	   R   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyR   ?  s   
	(   g      ?g      ?(   g      ?g      ?(   t
   __future__R    t   renpy.display.transformR]   t   renpy.displayR   t   renpy.display.renderR   t   renpy.display.layoutR   R   t   objectR:   R   R9   RQ   RR   RS   Rt   R   R   Ra   t   DisplayableR   R   R   R   R   R   t   layout(    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\motion.pyt   <module>   s<   
	0	+A		k{