<commit_before>#
# Cocos:
# http://code.google.com/p/los-cocos/
#

import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))

import pyglet
from pyglet.gl import *

from cocos.director import *
from cocos.scene import *
from cocos.layer import *
from cocos.actions import *

import random; rr = random.randrange


class BackLayer( Layer ):

    def __init__( self ):
        super( BackLayer, self).__init__()
        self.image = pyglet.resource.image('flag.png')

    def on_draw( self ):
        self.image.blit(0,0)

if __name__ == "__main__":
    director.init( resizable=True)
    scene = Scene( BackLayer() )

    lens = Lens3D( radius=150, lens_effect=0.7, center=(150,150), grid=(20,16), duration=10)
    jump = Jump(150,360,5,5 )

    action = scene.do( lens )
    scene.do( jump + Reverse(jump), target=action)
    director.run( scene )
<commit_msg>added documentation to jumping_lens<commit_after>#
# Cocos:
# http://code.google.com/p/los-cocos/
#

import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))

import pyglet

from cocos.director import director
from cocos.scene import Scene
from cocos.layer import Layer
from cocos.actions import Jump, Lens3D, Reverse

# create a layer with an image
class BackgroundLayer( Layer ):
    def __init__( self ):
        # always call super()
        super( BackgroundLayer, self).__init__()

        # load the image form file
        self.image = pyglet.resource.image('flag.png')

    def on_draw( self ):
        # blit the image on every frame
        self.image.blit(0,0)

if __name__ == "__main__":
    # initialize the director,
    # enabling to resize the main window
    director.init( resizable=True)

    # create an Scene with 1 layer: BackgroundLayer
    scene = Scene( BackgroundLayer() )


    # create a Lens effect action
    #  radius: 150 pixels
    #  lens_effect: 0.7, a strong "lens". 0 means no effect at all. 1 means very strong
    #  center: center of the lens
    #  grid=(20,16): create a grid of 20 tiles x 16 tiles. Bigger grids will
    #     look better but the performance will decraese
    #  duration=10: 10 seconds
    lens = Lens3D( radius=150, lens_effect=0.7, center=(150,150), grid=(20,16), duration=50)

    # create a Jump action
    # Jump to the right 360 pixels doing:
    #   3 jumps
    #   of height 170 pixels
    #  in 4 seconds
    jump = Jump(170,360,3,4 )

    # do and get the cloned action of lens'
    action = scene.do( lens )

    # perform the Jump action using as target the lens effect.
    # the Jump action will modify the 'position' attribute, and
    # the lens action uses the 'position' attribute as the center of the lens
    #
    # The action Jump + Reverse(Jump) will be repeated 5 times
    scene.do( (jump + Reverse(jump)) * 5, target=action)

    # Run!
    director.run( scene )

{'fraction_non_alphanumeric': 0.11045296167247387, 'fraction_numerical': 0.031010452961672475, 'mean_word_length': 3.0153846153846153, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4404702', 'n_tokens_mistral': 1009, 'n_tokens_neox': 911, 'n_words': 302}