Browse Source

filmgrain license

master
RENOX 4 months ago
parent
commit
ad9e09f3d3
1 changed files with 14 additions and 3 deletions
  1. +14
    -3
      src/main/resources/static/js/filmgrain.js

+ 14
- 3
src/main/resources/static/js/filmgrain.js View File

@@ -1,4 +1,15 @@
// Credit: Szenia Zadvornykh
/*
Copyright (c) 2020 by Szenia Zadvornykh (https://codepen.io/zadvorsky/pen/PwyoMm)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

var viewWidth,
viewHeight,
@@ -18,7 +29,7 @@ var patternPixelDataLength = patternSize * patternSize * 4,
patternData,
frame = 0;

window.onload = function() {
window.onload = function () {
initCanvas();
initGrain();
requestAnimationFrame(loop);
@@ -49,7 +60,7 @@ function update() {
for (var i = 0; i < patternPixelDataLength; i += 4) {
value = (Math.random() * 255) | 0;

patternData.data[i ] = value;
patternData.data[i] = value;
patternData.data[i + 1] = value;
patternData.data[i + 2] = value;
patternData.data[i + 3] = patternAlpha;


Loading…
Cancel
Save