-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathturtle-animate.html
30 lines (29 loc) · 980 Bytes
/
turtle-animate.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Turtle</title>
</head>
<body>
<script type="text/javascript" src="./js/1px-fix.js"></script>
<script type="text/javascript" src="./js/turtle.js"></script>
<script type="text/javascript" src="./js/demo.js"></script>
<script type="text/javascript">
//init turtle
let t = new Turtle({ debug: false, animate: 8 }) //关闭debug打印
demo1(t) // regular polygon
demo2(t) // regular star polygon
demo3(t) // constant velocity helix + golden spiral
demo4(t) // variable speed helix
demo5(t) // Koch curve
demo6(t) // Fractal Tree
demo7(t) // Sierpinski triangle
demo8(t) // Leaf
// function test1() {
// t.to('t0').fd(0.1).rt(2).repeat(90) // combine
// t.to('t1').fd(0.1).lt(2).repeat(90)
// t.to().add('t0').add('t1').rt(90).repeat(4).rt(36).repeat(10).go()
// }
</script>
</body>
</html>