littlejsengine 1.18.2 → 1.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html><meta charset=utf-8><body>
2
- <script src=../../dist/littlejs.js?1.18.2></script>
2
+ <script src=../../dist/littlejs.js?1.18.4></script>
3
3
  <script src=../../dist/box2d.wasm.js></script>
4
4
 
5
5
  <!-- LittleJS Engine Source
@@ -0,0 +1,12 @@
1
+ function gameRender()
2
+ {
3
+ // draw a wrapped texture
4
+ drawTextureWrapped(vec2(-6, 2), vec2(12, 6), vec2(3, 2));
5
+
6
+ // draw red tinted wrapped and rotating
7
+ drawTextureWrapped(vec2(9, 2), vec2(6, 6), vec2(2), 0, RED, time);
8
+
9
+ // animated wrap count
10
+ const wraps = 2 - sin(time);
11
+ drawTextureWrapped(vec2(0, -5), vec2(12, 4), vec2(wraps, 1/16));
12
+ }
@@ -0,0 +1,24 @@
1
+ const slider = { pos: vec2(-3, 1) };
2
+ const pulser = { color: RED };
3
+ let bouncerY = 4;
4
+
5
+ function gameInit()
6
+ {
7
+ // tween using the Tween class directly
8
+ new Tween((y) => bouncerY = y, 4, -3, 1.5,
9
+ { ease: Ease.OUT(Ease.BOUNCE) }).pingPong();
10
+
11
+ // tweens using tweenProperty helper
12
+ tweenProperty(slider, 'pos', vec2(-3, 1), vec2(3, -1), 2,
13
+ { ease: Ease.IN_OUT(Ease.SINE) }).pingPong();
14
+
15
+ // tween using built in color class
16
+ tweenProperty(pulser, 'color', RED, BLUE, 1).pingPong();
17
+ }
18
+
19
+ function gameRender()
20
+ {
21
+ drawRect(vec2(-6, bouncerY), vec2(2), GREEN);
22
+ drawRect(slider.pos, vec2(2), CYAN);
23
+ drawRect(vec2(6, 0), vec2(2), pulser.color);
24
+ }