File tree 1 file changed +55
-0
lines changed 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < head >
3
+ < title > Bouncing Bunny with Scheme instead of JavaScript</ title >
4
+
5
+ < style >
6
+ body {
7
+ background : gray;
8
+ text-align : center;
9
+ }
10
+ # field {
11
+ background : cyan;
12
+ margin : 0px auto;
13
+ position : relative;
14
+ width : 640px ;
15
+ height : 480px ;
16
+ }
17
+ # bunny {
18
+ position : absolute;
19
+ height : 100px ;
20
+ }
21
+ </ style >
22
+ </ head >
23
+ < body >
24
+ < div id ="field ">
25
+ < h1 > Heeey, I'm Jumping Bunny!</ h1 >
26
+ < img id ="bunny " src ="https://codeabbey.github.io/js-things/bunny/bunny2.png "/>
27
+ </ div >
28
+
29
+ < script src ="https://codeabbey.github.io/js-things/biwascheme.js ">
30
+
31
+ ( define x 0 )
32
+ ( define y 0 )
33
+
34
+ ( define field ( getelem "#field" ) )
35
+ ( define fieldW ( element - width field ) )
36
+ ( define fieldH ( element - height field ) )
37
+
38
+ ( define bunny ( getelem "#bunny" ) )
39
+
40
+ ( define ( bunnyMove left top )
41
+ ( set - style ! bunny "left" left )
42
+ ( set - style ! bunny "top" top ) )
43
+
44
+ ( define updatePosition
45
+ ( lambda ( )
46
+ ( set ! x ( + x 1 ) )
47
+ ( set ! y ( + y 1 ) )
48
+ ( bunnyMove x y ) ) )
49
+
50
+ ( set - timer ! updatePosition 0.05 )
51
+
52
+ </ script >
53
+
54
+ </ body >
55
+ </ html>
You can’t perform that action at this time.
0 commit comments