Command: | Timer |
Codeskulptor: | timer = simplegui.create_timer(500, timer_handler) |
Codeskulptor: | (later in script when readey to start)timer.start() |
EzpzJs: | TimerInterval(a, b, c, d) |
EzpzJs Explaination | a= TimerName, b = TimerVar, c = frequency, d = function to execute |
EzPzJs Literal: | TimerInterval("MyTimer", "TimerVar", 40, DrawHandler); |
EzpzJs Notes: | This command doesn't include a starter. Just use a condition when the time is right to start the timer. Also
there is no draw handler. Just set your timer for frame frequency. |
Command: | Canvas |
Codeskulptor: | frame = simplegui.create_frame(Frame Name, Width, Height) |
Codeskulptor Literal: | frame = simplegui.create_frame('Testing', 100, 100) |
Codeskulptor Later in Code: | frame.start |
CodeSkulptor Note: | In Codeskulptor, calling a window (called frame) is creating a canvas |
---- | --- |
EzpzJs: | canvas(name, width, height); |
EzpzJs Literal: | canvas("myCanvas", 500, 500); |
EzpzJs Note: | There is no need to call a start to the frame or
canvas, it appears in the first html window, but you must set a color to the
frame or else your animations will look funky. |
Command: | Square on Canvas |
Codeskulptor Explain: | canvas.draw_polygon([[pos1], [pos2], [pos3], [pos4]], line_width, 'line color', 'fill color') |
Codeskulptor Literal: | canvas.draw_polygon([[90, 70], [80, 40], [70, 90], [70, 70]], 12, 'Yellow', 'Orange') |
EzpzJs Explain: | canvasQuad(name, color, pos1[0], pos1[1], pos2[0], pos2[1]); |
EzpzJs Literal: | canvasQuad("myCanvas", "Grey", 0, 0, 400, 400); |
Notes: | Codeskulptor can do triangles and quads in one command. |
Command: | Line on Canvas |
Codeskulptor Explain: | canvas.draw_line(point1, point2, line_width, line_color) |
Codeskulptor Literal: | canvas.draw_line((10, 20), (30, 40), 12, 'Red') |
EzpzJs Explain: | canvasLine(name, color, width, x1, y1, x2, y2) |
EzpzJs Literal: | canvasLine("myCanvas", "Green", 10, 0, 0, 500, 500); |
Command: | Draw a circle on canvas |
Codeskulptor Explaination: | canvas.draw_circle(center_point, radius, line_width, line_color, fill_color) |
Codeskulptor Literal: | canvas.draw_circle((50, 50), 20, 5, 'Blue', 'White') |
EzpzJs Explaination: | canvasCircle(name, radius, line color, fill color, line width, center x, center y); |
EzpzJs Literal: | canvasCircle("myCanvas", 80, "Orange", "Yellow", 8, 160, 300); |
Command: | Place a small point on canvas |
Codeskulptor Explaination: | canvas.draw_point(point, color) |
Codeskulptor Literal: | canvas.draw_point((10, 10), 'Green') |
EzpzJs Explaination: | canvasPoint(name, color, x1, y1); |
EzpzJs Literal: | canvasPoint("myCanvas", "Green", 250, 46); |
Command: | Draw text on canvas |
Codeskulptor Explaination: | canvas.draw_text(text, point, font_size, font_color, font_face) |
Codeskulptor Literal: | canvas.draw_text('C', (80, 50), 12, 'Gray', 'serif') |
EzpzJs Explaination: | canvasText(name, text, color, size, fontnumber, x, y); |
EzpzJs Literal: | canvasText("myCanvas", "Purple", "Purple", 35, 1, 225, 100); |
Command: | Complex Image Placement |
Codeskulptor Explaination: | canvas.draw_image(image, center_source, width_height_source, center_dest, width_height_dest, rotation) |
Codeskulptor Literal: | canvas.draw_image(image, (1521 // 2, 1818 // 2), (1521, 1818), (40, 70), (100, 100), 2) |
Codeskulptor Note: | the last variable called rotation is optional |
---- | ----- |
EzpzJs Explaination: | canvasComplexImage(name, picturelocaction, x center of source, y center of source, wid of clip, ht of clip, x placement, y place, wid of place, ht of place, roatation)
|
EzpzJs Literal: | canvasComplexImage("myCanvas", yy, 36, 48, 72, 96, 36, 48, 72, 96, 0.5); |
EzpzJs Note: | Rotation is not optional; just mark 0 for normal. |