Forked from spite/gist:90e3dbf8e117660f6788a5748ae06cad
Last active
December 30, 2016 09:34
-
-
Save Piskvor/41df1f68b44b43100552126c76e2f609 to your computer and use it in GitHub Desktop.
Go to https://lines.chromeexperiments.com/drag/, start the experience and run this code in the console - or install it as a userscript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment