Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Basthon
Basthon Kernel
Commits
037e278f
Commit
037e278f
authored
Oct 06, 2022
by
Romain Casati
Browse files
Python 3: fix rotation in turtle.
parent
bb5f0768
Changes
3
Hide whitespace changes
Inline
Side-by-side
packages/kernel-python3/src/modules/turtle/turtle/__init__.py
View file @
037e278f
...
...
@@ -1287,8 +1287,8 @@ class Turtle(TPen, TNavigator):
attributeName
=
"transform"
,
Id
=
new_frame_id
,
type
=
"rotate"
,
From
=
(
self
.
_old_heading
,
0
,
0
)
,
to
=
(
new_heading
,
0
,
0
)
,
From
=
f
"
{
self
.
_old_heading
}
,0,0"
,
to
=
f
"
{
new_heading
}
,0,0"
,
begin
=
previous_end
,
dur
=
duration
,
fill
=
"freeze"
))
else
:
...
...
@@ -1412,8 +1412,8 @@ class Turtle(TPen, TNavigator):
appendTo
(
_turtle
,
SVG
.
animateTransform
(
attributeName
=
"transform"
,
type
=
"rotate"
,
From
=
(
self
.
_old_heading
,
0
,
0
)
,
to
=
(
self
.
_old_heading
,
0
,
0
)
,
From
=
f
"
{
self
.
_old_heading
}
,0,0"
,
to
=
f
"
{
self
.
_old_heading
}
,0,0"
,
begin
=
previous_end
,
dur
=
_CFG
[
"min_duration"
],
fill
=
"freeze"
))
...
...
tests/data/python3-old_turtle.svg
View file @
037e278f
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"640"
height=
"480"
preserveaspectratio=
"xMidYMid slice"
viewbox=
"0 0 640 480"
><animate
id=
"af_0"
attributename=
"opacity"
attributetype=
"CSS"
from=
"1"
to=
"1"
begin=
"0s"
dur=
"1ms"
fill=
"freeze"
></animate><g
transform=
"translate(320 240)"
></g><g
transform=
"translate(320 240)"
><line
x1=
"0"
y1=
"0"
x2=
"0"
y2=
"0"
style=
"stroke: black;stroke-width: 1"
><animate
id=
"af_2"
attributename=
"x2"
attributetype=
"XML"
from=
"0"
to=
"0"
dur=
"1ms"
fill=
"freeze"
begin=
"af_1.end"
></animate><animate
attributename=
"y2"
attributetype=
"XML"
begin=
"af_1.end"
from=
"0"
to=
"0"
dur=
"1ms"
fill=
"freeze"
></animate></line><line
x1=
"0"
y1=
"0"
x2=
"0"
y2=
"0"
style=
"stroke: black;stroke-width: 1"
><animate
id=
"af_5"
attributename=
"x2"
attributetype=
"XML"
from=
"0"
to=
"100"
dur=
" 0.535s"
fill=
"freeze"
begin=
"af_4.end"
></animate><animate
attributename=
"y2"
attributetype=
"XML"
begin=
"af_4.end"
from=
"0"
to=
"0"
dur=
" 0.535s"
fill=
"freeze"
></animate></line></g><g
transform=
"translate(320 240)"
></g><g
transform=
"translate(320 240)"
><polygon
points=
"0,16 -2,14 -1,10 -4,7 -7,9 -9,8 -6,5 -7,1 -5,-3 -8,-6 -6,-8 -4,-5 0,-7 4,-5 6,-8 8,-6 5,-3 7,1 6,5 9,8 7,9 4,7 1,10 2,14"
stroke=
"black"
fill=
"black"
stroke-width=
"1"
opacity=
"0"
><animate
id=
"af_1"
begin=
"af_0.end"
dur=
"1ms"
fill=
"freeze"
attributename=
"opacity"
attributetype=
"XML"
from=
"0"
to=
"1"
></animate><animateMotion
begin=
"af_2.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateTransform
attributename=
"transform"
id=
"af_3"
type=
"rotate"
from=
"0,0,0"
to=
"0,0,0"
begin=
"af_2.end"
dur=
"1ms"
fill=
"freeze"
></animateTransform><animateMotion
begin=
"af_3.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateTransform
attributename=
"transform"
id=
"af_4"
type=
"rotate"
from=
"-90,0,0"
to=
"-90,0,0"
begin=
"af_3.end"
dur=
"1ms"
fill=
"freeze"
></animateTransform><animateMotion
begin=
"af_4.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateMotion
from=
"0.0,-0.0"
to=
"100.0,-0.0"
dur=
" 0.535s"
begin=
"af_4.end"
fill=
"freeze"
></animateMotion></polygon></g></svg>
\ No newline at end of file
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"640"
height=
"480"
preserveaspectratio=
"xMidYMid slice"
viewbox=
"0 0 640 480"
><animate
id=
"af_0"
attributename=
"opacity"
attributetype=
"CSS"
from=
"1"
to=
"1"
begin=
"0s"
dur=
"1ms"
fill=
"freeze"
></animate><g
transform=
"translate(320 240)"
></g><g
transform=
"translate(320 240)"
><line
x1=
"0"
y1=
"0"
x2=
"0"
y2=
"0"
style=
"stroke: black;stroke-width: 1"
><animate
id=
"af_2"
attributename=
"x2"
attributetype=
"XML"
from=
"0"
to=
"0"
dur=
"1ms"
fill=
"freeze"
begin=
"af_1.end"
></animate><animate
attributename=
"y2"
attributetype=
"XML"
begin=
"af_1.end"
from=
"0"
to=
"0"
dur=
"1ms"
fill=
"freeze"
></animate></line><line
x1=
"0"
y1=
"0"
x2=
"0"
y2=
"0"
style=
"stroke: black;stroke-width: 1"
><animate
id=
"af_5"
attributename=
"x2"
attributetype=
"XML"
from=
"0"
to=
"100"
dur=
" 0.535s"
fill=
"freeze"
begin=
"af_4.end"
></animate><animate
attributename=
"y2"
attributetype=
"XML"
begin=
"af_4.end"
from=
"0"
to=
"0"
dur=
" 0.535s"
fill=
"freeze"
></animate></line></g><g
transform=
"translate(320 240)"
></g><g
transform=
"translate(320 240)"
><polygon
points=
"0,16 -2,14 -1,10 -4,7 -7,9 -9,8 -6,5 -7,1 -5,-3 -8,-6 -6,-8 -4,-5 0,-7 4,-5 6,-8 8,-6 5,-3 7,1 6,5 9,8 7,9 4,7 1,10 2,14"
stroke=
"black"
fill=
"black"
stroke-width=
"1"
opacity=
"0"
><animate
id=
"af_1"
begin=
"af_0.end"
dur=
"1ms"
fill=
"freeze"
attributename=
"opacity"
attributetype=
"XML"
from=
"0"
to=
"1"
></animate><animateMotion
begin=
"af_2.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateTransform
attributename=
"transform"
id=
"af_3"
type=
"rotate"
from=
"0,0,0"
to=
"0.0,0,0"
begin=
"af_2.end"
dur=
"1ms"
fill=
"freeze"
></animateTransform><animateMotion
begin=
"af_3.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateTransform
attributename=
"transform"
id=
"af_4"
type=
"rotate"
from=
"-90.0,0,0"
to=
"-90.0,0,0"
begin=
"af_3.end"
dur=
"1ms"
fill=
"freeze"
></animateTransform><animateMotion
begin=
"af_4.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateMotion
from=
"0.0,-0.0"
to=
"100.0,-0.0"
dur=
" 0.535s"
begin=
"af_4.end"
fill=
"freeze"
></animateMotion></polygon></g></svg>
\ No newline at end of file
tests/data/python3_turtle.svg
View file @
037e278f
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"640"
height=
"480"
preserveaspectratio=
"xMidYMid slice"
viewbox=
"0 0 640 480"
><animate
id=
"af_0"
attributename=
"opacity"
attributetype=
"CSS"
from=
"1"
to=
"1"
begin=
"0s"
dur=
"1ms"
fill=
"freeze"
></animate><g
transform=
"translate(320 240)"
></g><g
transform=
"translate(320 240)"
><line
x1=
"0"
y1=
"0"
x2=
"0"
y2=
"0"
style=
"stroke: black;stroke-width: 1"
><animate
id=
"af_2"
attributename=
"x2"
attributetype=
"XML"
from=
"0"
to=
"0"
dur=
"1ms"
fill=
"freeze"
begin=
"af_1.end"
></animate><animate
attributename=
"y2"
attributetype=
"XML"
begin=
"af_1.end"
from=
"0"
to=
"0"
dur=
"1ms"
fill=
"freeze"
></animate></line><line
x1=
"0"
y1=
"0"
x2=
"0"
y2=
"0"
style=
"stroke: black;stroke-width: 1"
><animate
id=
"af_5"
attributename=
"x2"
attributetype=
"XML"
from=
"0"
to=
"100"
dur=
" 0.535s"
fill=
"freeze"
begin=
"af_4.end"
></animate><animate
attributename=
"y2"
attributetype=
"XML"
begin=
"af_4.end"
from=
"0"
to=
"0"
dur=
" 0.535s"
fill=
"freeze"
></animate></line></g><g
transform=
"translate(320 240)"
></g><g
transform=
"translate(320 240)"
><polygon
points=
"0,16 -2,14 -1,10 -4,7 -7,9 -9,8 -6,5 -7,1 -5,-3 -8,-6 -6,-8 -4,-5 0,-7 4,-5 6,-8 8,-6 5,-3 7,1 6,5 9,8 7,9 4,7 1,10 2,14"
stroke=
"black"
fill=
"black"
stroke-width=
"1"
opacity=
"0"
><animate
id=
"af_1"
begin=
"af_0.end"
dur=
"1ms"
fill=
"freeze"
attributename=
"opacity"
attributetype=
"XML"
from=
"0"
to=
"1"
></animate><animateMotion
begin=
"af_2.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateTransform
attributename=
"transform"
id=
"af_3"
type=
"rotate"
from=
"(0, 0, 0)"
to=
"(0.0, 0, 0)"
begin=
"af_2.end"
dur=
"1ms"
fill=
"freeze"
></animateTransform><animateMotion
begin=
"af_3.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateTransform
attributename=
"transform"
id=
"af_4"
type=
"rotate"
from=
"(-90.0, 0, 0)"
to=
"(-90.0, 0, 0)"
begin=
"af_3.end"
dur=
"1ms"
fill=
"freeze"
></animateTransform><animateMotion
begin=
"af_4.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateMotion
from=
"0.0,-0.0"
to=
"100.0,-0.0"
dur=
" 0.535s"
begin=
"af_4.end"
fill=
"freeze"
></animateMotion></polygon></g></svg>
\ No newline at end of file
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"640"
height=
"480"
preserveaspectratio=
"xMidYMid slice"
viewbox=
"0 0 640 480"
><animate
id=
"af_0"
attributename=
"opacity"
attributetype=
"CSS"
from=
"1"
to=
"1"
begin=
"0s"
dur=
"1ms"
fill=
"freeze"
></animate><g
transform=
"translate(320 240)"
></g><g
transform=
"translate(320 240)"
><line
x1=
"0"
y1=
"0"
x2=
"0"
y2=
"0"
style=
"stroke: black;stroke-width: 1"
><animate
id=
"af_2"
attributename=
"x2"
attributetype=
"XML"
from=
"0"
to=
"0"
dur=
"1ms"
fill=
"freeze"
begin=
"af_1.end"
></animate><animate
attributename=
"y2"
attributetype=
"XML"
begin=
"af_1.end"
from=
"0"
to=
"0"
dur=
"1ms"
fill=
"freeze"
></animate></line><line
x1=
"0"
y1=
"0"
x2=
"0"
y2=
"0"
style=
"stroke: black;stroke-width: 1"
><animate
id=
"af_5"
attributename=
"x2"
attributetype=
"XML"
from=
"0"
to=
"100"
dur=
" 0.535s"
fill=
"freeze"
begin=
"af_4.end"
></animate><animate
attributename=
"y2"
attributetype=
"XML"
begin=
"af_4.end"
from=
"0"
to=
"0"
dur=
" 0.535s"
fill=
"freeze"
></animate></line></g><g
transform=
"translate(320 240)"
></g><g
transform=
"translate(320 240)"
><polygon
points=
"0,16 -2,14 -1,10 -4,7 -7,9 -9,8 -6,5 -7,1 -5,-3 -8,-6 -6,-8 -4,-5 0,-7 4,-5 6,-8 8,-6 5,-3 7,1 6,5 9,8 7,9 4,7 1,10 2,14"
stroke=
"black"
fill=
"black"
stroke-width=
"1"
opacity=
"0"
><animate
id=
"af_1"
begin=
"af_0.end"
dur=
"1ms"
fill=
"freeze"
attributename=
"opacity"
attributetype=
"XML"
from=
"0"
to=
"1"
></animate><animateMotion
begin=
"af_2.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateTransform
attributename=
"transform"
id=
"af_3"
type=
"rotate"
from=
"0,0,0"
to=
"0.0,0,0"
begin=
"af_2.end"
dur=
"1ms"
fill=
"freeze"
></animateTransform><animateMotion
begin=
"af_3.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateTransform
attributename=
"transform"
id=
"af_4"
type=
"rotate"
from=
"-90.0,0,0"
to=
"-90.0,0,0"
begin=
"af_3.end"
dur=
"1ms"
fill=
"freeze"
></animateTransform><animateMotion
begin=
"af_4.end"
dur=
"1ms"
fill=
"remove"
></animateMotion><animateMotion
from=
"0.0,-0.0"
to=
"100.0,-0.0"
dur=
" 0.535s"
begin=
"af_4.end"
fill=
"freeze"
></animateMotion></polygon></g></svg>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment