{% extends '@nucleus/partials/particle.html.twig' %}

{% block javascript_footer %}
{% do gantry.load('jquery') %}
<script src="{{ url('gantry-theme://js/particles.min.js') }}"></script>
<script>
var $ = jQuery;
var interact = {
  "resize": true
};
</script>
{% for item in particle.items %}
{% if item.style == 1 %}
<script>
particlesJS('{{item.element}}', {
  "particles": {
    "number": {
      "value": {{item.number}},
      "density": {
        "enable": true,
        "value_area": 490
      }
    },
    "color": {
      "value": "#ffffff"
    },
    "shape": {
      "type": "circle"
    },
    "opacity": {
      "value": 0.5,
      "random": false,
      "anim": {
        "enable": false,
        "speed": 1,
        "opacity_min": 0.1,
        "sync": false
      }
    },
    "size": {
      "value": 3,
      "random": true,
      "anim": {
        "enable": false,
        "speed": 40,
        "size_min": 0.1,
        "sync": false
      }
    },
    "line_linked": {
      "enable": true,
      "distance": 150,
      "color": "#ffffff",
      "opacity": 0.4,
      "width": 1
    },
    "move": {
      "enable": true,
      "speed": {{item.speed}},
      "direction": "none",
      "random": false,
      "straight": false,
      "out_mode": "{{item.outmode}}",
      "attract": {
        "enable": false,
        "rotateX": 600,
        "rotateY": 1200
      }
    }
  },
  "interactivity": {
    "detect_on": "canvas",
    "events": interact,
    "modes": {
      "grab": {
        "distance": 140,
        "line_linked": {
          "opacity": 1
        }
      },
      "bubble": {
        "distance": 200,
        "size": 5,
        "duration": 2,
        "opacity": 8,
        "speed": 3
      },
      "repulse": {
        "distance": 200,
        "duration": 0.4
      },
      "push": {
        "particles_nb": 4
      },
      "remove": {
        "particles_nb": 2
      }
    }
  },
  "retina_detect": true
});
$("#{{item.element}}").css("display", "block");
$("#{{item.element}}").css("position", "relative");

$(".particles-js-canvas-el").css("display", "block");
$(".particles-js-canvas-el").css("position", "absolute");
$(".particles-js-canvas-el").css("top", "0");
$(".particles-js-canvas-el").css("bottom", "0");

$("#{{item.element}} > .particles-js-canvas-el").css("z-index", "{{item.zindex}}");
</script>
{% endif %}
{% if item.style == 2 %}
<script>
particlesJS('{{item.element}}', {
  "particles": {
    "number": {
      "value": {{item.number}},
      "density": {
        "enable": true,
        "value_area": 490
      }
    },
    "color": {
      "value": "#ffffff"
    },
    "shape": {
      "type": "polygon",
      "polygon": {
        "nb_sides": 6
      }
    },
    "opacity": {
      "value": 0.03,
      "random": true,
      "anim": {
        "enable": false,
        "speed": 1,
        "opacity_min": 0.1,
        "sync": false
      }
    },
    "size": {
      "value": 160,
      "random": true,
      "anim": {
        "enable": false,
        "speed": 10,
        "size_min": 40,
        "sync": false
      }
    },
    "line_linked": {
      "enable": false,
      "distance": 200,
      "color": "#ffffff",
      "opacity": 0.4,
      "width": 1
    },
    "move": {
      "enable": true,
      "speed": {{item.speed}},
      "direction": "none",
      "random": false,
      "straight": false,
      "out_mode": "{{item.outmode}}",
      "attract": {
        "enable": false,
        "rotateX": 600,
        "rotateY": 1200
      }
    }
  },
  "interactivity": {
    "detect_on": "canvas",
    "events": interact,
    "modes": {
      "grab": {
        "distance": 140,
        "line_linked": {
          "opacity": 1
        }
      },
      "bubble": {
        "distance": 200,
        "size": 5,
        "duration": 2,
        "opacity": 8,
        "speed": 3
      },
      "repulse": {
        "distance": 200,
        "duration": 0.4
      },
      "push": {
        "particles_nb": 4
      },
      "remove": {
        "particles_nb": 2
      }
    }
  },
  "retina_detect": true
});

$("#{{item.element}}").css("display", "block");
$("#{{item.element}}").css("position", "relative");

$(".particles-js-canvas-el").css("display", "block");
$(".particles-js-canvas-el").css("position", "absolute");
$(".particles-js-canvas-el").css("top", "0");
$(".particles-js-canvas-el").css("bottom", "0");

$("#{{item.element}} > .particles-js-canvas-el").css("z-index", "{{item.zindex}}");
</script>
{% endif %}

{% if item.style == 3 %}
<script>
particlesJS('{{item.element}}', {
  "particles": {
    "number": {
      "value": {{item.number}},
      "density": {
        "enable": true,
        "value_area": 800
      }
    },
    "color": {
      "value": "#ffffff"
    },
    "shape": {
      "type": "circle"
    },
    "opacity": {
      "value": 0.4,
      "random": true,
      "anim": {
        "enable": false,
        "speed": 1,
        "opacity_min": 0.1,
        "sync": false
      }
    },
    "size": {
      "value": 10,
      "random": true,
      "anim": {
        "enable": false,
        "speed": 40,
        "size_min": 0.1,
        "sync": false
      }
    },
    "line_linked": {
      "enable": false,
      "distance": 500,
      "color": "#ffffff",
      "opacity": 0.4,
      "width": 2
    },
    "move": {
      "enable": true,
      "speed": {{item.speed}},
      "direction": "bottom",
      "random": false,
      "straight": false,
      "out_mode": "{{item.outmode}}",
      "attract": {
        "enable": false,
        "rotateX": 600,
        "rotateY": 1200
      }
    }
  },
  "interactivity": {
    "detect_on": "canvas",
    "events": interact,
    "modes": {
      "grab": {
        "distance": 140,
        "line_linked": {
          "opacity": 1
        }
      },
      "bubble": {
        "distance": 200,
        "size": 5,
        "duration": 2,
        "opacity": 8,
        "speed": 3
      },
      "repulse": {
        "distance": 200,
        "duration": 0.4
      },
      "push": {
        "particles_nb": 4
      },
      "remove": {
        "particles_nb": 2
      }
    }
  },
  "retina_detect": true
});

$("#{{item.element}}").css("display", "block");
$("#{{item.element}}").css("position", "relative");

$(".particles-js-canvas-el").css("display", "block");
$(".particles-js-canvas-el").css("position", "absolute");
$(".particles-js-canvas-el").css("top", "0");
$(".particles-js-canvas-el").css("bottom", "0");

$("#{{item.element}} > .particles-js-canvas-el").css("z-index", "{{item.zindex}}");
</script>
{% endif %}

{% if item.style == 4 %}
<script>
particlesJS('{{item.element}}', {{item.custom|html|raw}});
$("#{{item.element}}").css("display", "block");
$("#{{item.element}}").css("position", "relative");

$(".particles-js-canvas-el").css("display", "block");
$(".particles-js-canvas-el").css("position", "absolute");
$(".particles-js-canvas-el").css("top", "0");
$(".particles-js-canvas-el").css("bottom", "0");

$("#{{item.element}} > .particles-js-canvas-el").css("z-index", "{{item.zindex}}");
</script>
{% endif %}

{% endfor %}
{% endblock %}
