@@ -15,30 +15,36 @@ Full API reference:
1515```
1616
1717::: 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.
2819:::
2920
21+ ## Example usage
22+
3023<MojsInteractive
3124 id="example"
3225 autoplay
33- height="200px "
26+ height="400px "
3427 global="example"
28+ : controller =false
29+ notice="Click anywere to see the updated random value"
3530 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)',
3839});
3940
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();
4248});
4349
4450example.play();"
0 commit comments