<s> from __future__ import division , print_function , unicode_literals <EOL> import sys <EOL> import os <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT:..>' ) ) <EOL> testinfo = "<STR_LIT>" <EOL> tags = "<STR_LIT>" <EOL> import cocos <EOL> from cocos . director import director <EOL> from cocos . actions import Bezier <EOL> from cocos . sprite import Sprite <EOL> import pyglet <EOL> from cocos import path <EOL> def direct_bezier ( p0 , p1 , p2 , p3 ) : <EOL> '''<STR_LIT>''' <EOL> def _one_dim ( p0xy , B1xy , B2xy , p3xy ) : <EOL> '''<STR_LIT>''' <EOL> p2xy = ( <NUM_LIT> * B2xy - B1xy + <NUM_LIT> * p0xy - <NUM_LIT> * p3xy ) / <NUM_LIT> <EOL> p1xy = ( B2xy - <NUM_LIT> * p0xy - <NUM_LIT> * p2xy - <NUM_LIT> * p3xy ) / <NUM_LIT> <EOL> return p1xy , p2xy <EOL> bp1x , bp2x = _one_dim ( p0 [ <NUM_LIT:0> ] , p1 [ <NUM_LIT:0> ] , p2 [ <NUM_LIT:0> ] , p3 [ <NUM_LIT:0> ] ) <EOL> bp1y , bp2y = _one_dim ( p0 [ <NUM_LIT:1> ] , p1 [ <NUM_LIT:1> ] , p2 [ <NUM_LIT:1> ] , p3 [ <NUM_LIT:1> ] ) <EOL> bp1 = bp1x , bp1y <EOL> bp2 = bp2x , bp2y <EOL> bezier_path = path . Bezier ( p0 , p3 , bp1 , bp2 ) <EOL> return bezier_path <EOL> class TestLayer ( cocos . layer . Layer ) : <EOL> def __init__ ( self ) : <EOL> super ( TestLayer , self ) . __init__ ( ) <EOL> go_through = [ ( <NUM_LIT:100> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) ] <EOL> for pos in go_through : <EOL> sprite = Sprite ( '<STR_LIT>' ) <EOL> sprite . position = pos <EOL> sprite . scale = <NUM_LIT> <EOL> self . add ( sprite ) <EOL> bezier_path = direct_bezier ( * go_through ) <EOL> sprite = Sprite ( '<STR_LIT>' ) <EOL> sprite . scale = <NUM_LIT> <EOL> sprite . color = ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:255> ) <EOL> self . add ( sprite , z = <NUM_LIT:5> ) <EOL> sprite . do ( Bezier ( bezier_path , <NUM_LIT:5> ) ) <EOL> def main ( ) : <EOL> director . init ( width = <NUM_LIT> , height = <NUM_LIT> ) <EOL> test_layer = TestLayer ( ) <EOL> main_scene = cocos . scene . Scene ( test_layer ) <EOL> director . run ( main_scene ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
