apysc
apysc is the Python frontend library to create HTML and js files, that has ActionScript 3 (as3)-like interface.
Notes: Currently developing and only works partially.
Supported Python Version
Python 3.6 or later.
Installing
$ pip install apysc
How to start
Please see apysc documentation and quick start guide page.
What apysc can do in its current implementation
- Save HTML or use it on the Jupyter notebook, JupyterLab, and Google Colaboratory!
Documents: save_overall_html interface, display_on_jupyter interface, display_on_colaboratory interface
- Draw the many types of vector graphics
Example code fragments:
...
sprite.graphics.begin_fill(color='#0af')
rectangle: ap.Rectangle = sprite.graphics.draw_rect(
x=50, y=50, width=50, height=50)
...
Documents: begin_fill interface, line_style interface, draw_rect interface, draw_round_rect interface, draw_circle interface, draw_ellipse interfac, move_to and line_to interfaces, draw_line interface, draw_dotted_line interface, draw_dashed_line interface, draw_round_dotted_line interface, draw_dash_dotted_line interface, draw_dash_dotted_line interface, draw_polygon interface
- Lots of the vector graphics updating interfaces, such as the
x
,width
,rotation
,alpha (opacity)
,ellipse size
,scale
Example code fragments:
...
rectangle.x = ap.Int(100)
...
Document: x and y interfaces, visible interface, get_css and set_css interfaces, rotation_around_center interface, rotation_around_point interfaces, scale_x_from_center and scale_y_from_center interfaces, get_scale_from_point and set_scale_from_point interfaces, flip_x and flip_y interfaces, skew_x and skew_y interfaces
- Set each mouse event, such as the click, double click, mouse down, mouse up, mouse over, mouse out, mouse move
Example code fragments:
...
def on_click(e: ap.MouseEvent, options: dict) -> None:
ap.trace('Rectangle is clicked!')
rectangle.click(on_click)
...
Documents: Click interface, Double click interface, Mousedown and mouseup interfaces, Mouseover and mouseout interfaces, Mousemove interface
- Use the timer interface and animation
Example code fragments:
...
def on_timer(e: ap.TimerEvent, options: dict) -> None:
...
ap.Timer(on_timer, delay=1000).start()
...
Documents: Timer
- Lots of tween animations, including easing options
Example code fragments:
...
rectangle.animation_x(
x=100, duration=1000, easing=ap.Easing.EASE_IN_QUART,
).start()
...
Documents: Animation interfaces abstract (each animation attribute), AnimationEvent, Duration setting, Delay setting, Start interface, animation_complete interface, Method chaining, animation_pause and animation_play interfaces, animation_reset interface, animation_finish interface, animation_reverse interface, Sequential animation setting, animation_parallel interface
- Basic control, like the for loop, if branch instruction, and so on
Documents: If, Elif, Else, For
For more details, please see the following document:
What apysc can do in its current implementation
License
This library is released under the MIT License.
The logo image is using followed Creative Commons license font:
Also, the apysc library depends on the following libraries:
- jQuery, MIT License: https://github.com/jquery/jquery/blob/main/LICENSE.txt
- jQuery Mousewheel: https://github.com/jquery/jquery-mousewheel/blob/main/LICENSE.txt
- SVG.js, MIT License: https://github.com/svgdotjs/svg.js/blob/master/LICENSE.txt
- Underscore.js, MIT License: https://github.com/jashkenas/underscore/blob/master/LICENSE
- Static Typing for Python (Python official backport package): https://github.com/python/typing
- html-minifier, MIT License: https://github.com/Kaumer/html-minifier/blob/master/LICENSE