@@ -15,30 +15,36 @@ Full API reference:
15
15
```
16
16
17
17
::: tip
18
- If you wanna update the random value after it's been declared, you can use the ` generate() ` function:
19
- ``` js
20
- const example = new mojs.Burst ({
21
- radius: { ' rand(4, 40)' : ' rand(50, 100)' }
22
- });
23
-
24
- document .addEventListener ( ' click' , function (e ) {
25
- example .generate ().replay ();
26
- });
27
- ```
18
+ If you wanna update the random value after it's been declared, you can use the ` generate() ` function.
28
19
:::
29
20
21
+ ## Example usage
22
+
30
23
<MojsInteractive
31
24
id="example"
32
25
autoplay
33
- height="200px "
26
+ height="400px "
34
27
global="example"
28
+ : controller =false
29
+ notice="Click anywere to see the updated random value"
35
30
code=
36
- "const example = new mojs.Burst({
37
- radius: { 'rand(4, 40)' : 'rand(50, 100)' }
31
+ "const example = new mojs.ShapeSwirl({
32
+ parent: '#example',
33
+ left: 0, top: 0,
34
+ duration: 'rand(600, 1000)',
35
+ radius: 'rand(10, 20)',
36
+ pathScale: 'rand(.5, 1)',
37
+ swirlFrequency: 'rand(2, 4)',
38
+ swirlSize: 'rand(6, 14)',
38
39
});
39
40
40
- document.addEventListener( 'click', function (e) {
41
- example.generate().replay();
41
+ document.getElementById('example').addEventListener( 'click', function (e) {
42
+ const x = e.layerX,
43
+ y = { [ e.layerY] : e.layerY - 150 };
44
+ example
45
+ .tune({ x, y })
46
+ .generate()
47
+ .replay();
42
48
});
43
49
44
50
example.play();"
0 commit comments