PageSourceSearch

https://industryemea.com/packages/pagekit/imp-avion/js/particles.jquery.js?v=1a89

js industryemea.com collected 2026-09-26 05:19:46 UTC 5,572 bytes, 165 lines download raw bytes

1(function($) {
2
3    var id = 1;
4
5    var ColorUtil = {
6
7        lightOrDark: function(hexcolor) {
8            return this._rgbToHsl.apply(this, this._parseColor(hexcolor).slice(0,3))[2] <0.6 ? 'dark':'light';
9        },
10
11        _rgbToHsl: function(r, g, b){
12
13            r /= 255, g /= 255, b /= 255;
14
15            var max = Math.max(r, g, b), min = Math.min(r, g, b);
16            var h, s, l = (max + min) / 2;
17
18            if(max == min){
19                h = s = 0; // achromatic
20            }else{
21                var d = max - min;
22                s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
23                switch(max){
24                    case r: h = (g - b) / d + (g < b ? 6 : 0); break;
25                    case g: h = (b - r) / d + 2; break;
26                    case b: h = (r - g) / d + 4; break;
27                }
28                h /= 6;
29            }
30
31            return [h, s, l];
32        },
33
34        _parseColor: function(color) {
35
36            var match, quadruplet;
37
38            // match #aabbcc
39            if (match = /#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(color)) {
40                quadruplet = [parseInt(match[1], 16), parseInt(match[2], 16), parseInt(match[3], 16), 1];
41
42            // match #abc
43            } else if (match = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(color)) {
44                quadruplet = [parseInt(match[1], 16) * 17, parseInt(match[2], 16) * 17, parseInt(match[3], 16) * 17, 1];
45
46            // match rgb(n, n, n)
47            } else if (match = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
48                quadruplet = [parseInt(match[1]), parseInt(match[2]), parseInt(match[3]), 1];
49
50            // match rgba(n,n,n,o)
51            } else if (match = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(color)) {
52                quadruplet = [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10),parseFloat(match[4])];
53
54                // No browser returns rgb(n%, n%, n%), so little reason to support this format.
55            } else {
56                quadruplet = [255,255,255,0];
57            }
58
59            return quadruplet;
60        }
61    };
62
63
64    $.fn.particles = function(options) {
65
66        options = $.extend({
67            color: 'auto',
68            opacity: 0.35
69        }, options)
70
71
72        return this.each(function(){
73
74            var $container = $(this).css('position', 'relative'),
75                cid        = 'particles-'+(++id),
76                o          = $.extend({}, options, $container.data('particles') || {}),
77                color      = ColorUtil.lightOrDark($container.css('background-color')) == 'dark' ? '#ffffff':'#000000',
78                $canvas    = $('<div></div>').attr('id', cid).css({
79                    display: 'block',
80                    position: 'absolute',
81                    top: 0,
82                    right: 0,
83                    bottom: 0,
84                    left: 0
85                }).prependTo($container);
86
87            if (o.color && o.color !== 'auto') {
88                color = o.color;
89            }
90
91            particlesJS(cid, {
92                "particles": {
93                    "number": {
94                        "value": 100,
95                        "density": {
96                            "enable": true,
97                            "value_area": 800
98                        }
99                    },
100                    "color": {
101                        "value": color,
102                        "opacity": o.opacity
103                    },
104                    "shape": {
105                        "type": "circle",
106
107                    },
108                    "opacity": {
109                        "value": o.opacity,
110                        "random": false,
111                        "anim": {
112                            "enable": false,
113                            "speed": 1,
114                            "opacity_min": 0.1,
115                            "sync": false
116                        }
117                    },
118                    "size": {
119                        "value": 3,
120                        "random": true,
121                        "anim": {
122                            "enable": false,
123                            "speed": 40,
124                            "size_min": 0.1,
125                            "sync": false
126                        }
127                    },
128                    "line_linked": {
129                        "enable": true,
130                        "distance": 150,
131                        "color": color,
132                        "opacity": o.opacity,
133                        "width": 1
134                    },
135                    "move": {
136                        "enable": true,
137                        "speed": 3,
138                        "direction": "none",
139                        "random": false,
140                        "straight": false,
141                        "out_mode": "out",
142                        "bounce": true,
143                        "attract": {
144                            "enable": false,
145                            "rotateX": 600,
146                            "rotateY": 1200
147                        }
148                    }
149                },
150                "interactivity": {
151                    "detect_on": "canvas",
152                    "events": {
153                        "resize": true
154                    }
155                },
156                "retina_detect": true
157            });
158        });
159    };
160
161    $(function(){
162        $('[data-particles]').particles();
163    });
164
165})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.