// ==UserScript==
// @name         Animate the Lines WebGL experiment automatically
// @namespace    https://gist.github.com/spite/90e3dbf8e117660f6788a5748ae06cad
// @version      0.2
// @description  Automatically drags the mouse, leading to a pleasant effect
// @author       spite, userscripted by Piskvor
// @match        https://lines.chromeexperiments.com/drag/
// @grant        none
// @updateURL    https://gist.github.com/Piskvor/41df1f68b44b43100552126c76e2f609/raw/experiments_lines_drag.user.js
// ==/UserScript==

window.setTimeout(function() {
    // Your code here...
    document.getElementById( 'loading' ).style.display = 'none';
    var speed = 0.001; // changes the rate of rotation
    var distance = 4; // changes the distance the point travels
    function _update() {
        bAmDrawing = true;
        lastMouseX = 0; lastMouseY = 0;
        var a = speed * performance.now();
        var x = distance * Math.cos( a );
        var y = distance * Math.sin( a );
        stage.mousemove( { data: { global : { x: x, y: y } } }  );
    }
    function _animate() {
        _update();
        setTimeout( _animate, 1000 );
    }
    _animate();
}, 5000); // we should wait for the loader to actually finish, but this hack is quite sufficient for a toy