@@ -0,0 +1,2430 @@
+from pynodegl import Shader, TexturedShape, Group, UniformVec4%0Afrom pynodegl import Shape, ShapePrimitive%0Afrom pynodegl import AnimationScalar, AnimKeyFrameScalar%0A%0Afrom pynodegl_utils.misc import scene%0A%0Afrom OpenGL import GL%0A%0A_frag_data = %22%22%22%0A#version 100%0Aprecision mediump float;%0Auniform vec4 color;%0Avoid main(void)%0A%7B%0A    gl_FragColor = color;%0A%7D%22%22%22%0A%0A_colors = %5B%0A    (1, 0, 0, 0),%0A    (0, 1, 0, 0),%0A    (1, 0, 1, 0),%0A    (1, 1, 0, 0),%0A%5D%0A%0Adef _get_func(name, flags=0):%0A%0A    widgets = %5B%0A        %7B'name': 'nb_points', 'type': 'range', 'range': %5B2, 200%5D%7D,%0A        %7B'name': 'zoom', 'type': 'range', 'range': %5B0.1, 2%5D, 'unit_base': 100%7D%0A    %5D%0A%0A    versions = %5B%5D%0A    if flags & 1:%0A        versions += %5B'in', 'out'%5D%0A    if flags & 2:%0A        versions += %5B'in_out', 'out_in'%5D%0A%0A    if not flags:%0A        versions = %5BNone%5D%0A%0A    for ext in versions:%0A        if ext is not None:%0A            widgets.append(%7B'name': 'draw_' + ext, 'type': 'bool'%7D)%0A%0A    @scene(*widgets)%0A    def ret_func(cfg, nb_points=100, zoom=1,%0A                 draw_in=True, draw_out=True,%0A                 draw_in_out=True, draw_out_in=True):%0A%0A        g = Group()%0A        shader = Shader(fragment_data=_frag_data)%0A%0A        for idx, ext in enumerate(versions):%0A%0A            interp = name%0A            if ext is not None:%0A                interp += '_' + ext%0A                if not eval('draw_' + ext):%0A                    continue%0A%0A            anim = AnimationScalar(%5BAnimKeyFrameScalar(-1,-1),%0A                                    AnimKeyFrameScalar( 1, 1, interp)%5D)%0A%0A            vertices = %5B%5D%0A            for i in range(nb_points + 1):%0A                x = (i/float(nb_points) * 2 - 1)%0A                y = anim.evaluate(x * 1/zoom) * zoom%0A                vertices.append(ShapePrimitive((x, y, 0), (0, 0)))%0A%0A            shape = Shape(vertices, draw_mode=GL.GL_LINE_STRIP)%0A            tshape = TexturedShape(shape, shader)%0A            tshape.update_uniforms(color=UniformVec4(_colors%5Bidx%5D))%0A%0A            g.add_children(tshape)%0A        return g%0A    return ret_func%0A%0Alinear    = _get_func('linear')%0Aquadratic = _get_func('quadratic', 3)%0Acubic     = _get_func('cubic',     3)%0Aquartic   = _get_func('quartic',   3)%0Aquintic   = _get_func('quintic',   3)%0Asinus     = _get_func('sinus',     3)%0Aexp       = _get_func('exp',       3)%0Acircular  = _get_func('circular',  3)%0Abounce    = _get_func('bounce',    1)%0Aelastic   = _get_func('elastic',   1)%0Aback      = _get_func('back',      3)%0A

add animations scenes