Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!doctype html>
<meta name="viewport" content="width=device-width, user-scalable=no">
<container id="container"></container>
<script>
var N = 400;
var numKeyframes = 500;
var duration = 4000;

function makeKeyframes(numKeyframes, width, height) {
var keyframes = '@-webkit-keyframes anim {\n'
for (var i = 0; i < numKeyframes + 1; i++) {
var fraction = i / numKeyframes;
var t = fraction * 2 * Math.PI;
var x = Math.cos(t) - Math.pow(Math.cos(4*t), 3);
x = ((x/4 + 1/2) * width).toFixed(5);
var y = Math.pow(Math.sin(4*t), 3) - Math.sin(2*t);
y = ((y/4 + 1/2) * height).toFixed(5);
keyframes += (fraction*100) + '% { transform: translate(' + x + 'px, ' + y + 'px) }\n';
}
return keyframes;
}

var style = document.createElement('style');
style.textContent = makeKeyframes(numKeyframes, 550, 800);

for (var i = 0; i < N; i++) {
var target = document.createElement('target');
target.style.webkitAnimation = 'anim ' + duration + 'ms linear infinite -' + duration/10 * i/N + 'ms';
container.appendChild(target);
}

container.appendChild(style);

requestAnimationFrame(function() {
measurementReady = true;
});
</script>

<style>
body {
margin: 0;
overflow: hidden;
}
target {
position: absolute;
border: 5px solid green;
border-radius: 100%;
}
container {
position: absolute;
width: 550px;
height: 800px;
background-color: lightgrey;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!doctype html>
<meta name="viewport" content="width=device-width, user-scalable=no">
<container id="container"></container>
<script>
var N = 400;
var numKeyframes = 500;
var duration = 4000;

function makeKeyframes(numKeyframes, width, height) {
var keyframes = '@-webkit-keyframes anim {\n'
for (var i = 0; i < numKeyframes + 1; i++) {
var fraction = i / numKeyframes;
var t = fraction * 2 * Math.PI;
var x = Math.cos(t) - Math.pow(Math.cos(4*t), 3);
x = ((x/4 + 1/2) * width).toFixed(5);
var y = Math.pow(Math.sin(4*t), 3) - Math.sin(2*t);
y = ((y/4 + 1/2) * height).toFixed(5);
keyframes += (fraction*100) + '% { transform: translate(' + x + 'px, ' + y + 'px) }\n';
}
return keyframes;
}

var style = document.createElement('style');
style.textContent = makeKeyframes(numKeyframes, 550, 800);

for (var i = 0; i < N; i++) {
var target = document.createElement('target');
target.style.webkitAnimation = 'anim ' + duration + 'ms linear infinite -' + duration/10 * i/N + 'ms';
container.appendChild(target);
}

container.appendChild(style);

requestAnimationFrame(function() {
measurementReady = true;
});
</script>

<style>
body {
margin: 0;
overflow: hidden;
}
target {
position: absolute;
border: 5px solid green;
border-radius: 100%;
}
container {
position: absolute;
width: 550px;
height: 800px;
background-color: lightgrey;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!doctype html>
<meta name="viewport" content="width=device-width, user-scalable=no">
<container id="container"></container>
<script>
var N = 400;
var numKeyframes = 500;
var duration = 4000;

function makeKeyframes(numKeyframes, width, height) {
var keyframes = '@-webkit-keyframes anim {\n'
for (var i = 0; i < numKeyframes + 1; i++) {
var fraction = i / numKeyframes;
var t = fraction * 2 * Math.PI;
var x = Math.cos(t) - Math.pow(Math.cos(4*t), 3);
x = ((x/4 + 1/2) * width).toFixed(5);
var y = Math.pow(Math.sin(4*t), 3) - Math.sin(2*t);
y = ((y/4 + 1/2) * height).toFixed(5);
keyframes += (fraction*100) + '% { transform: translate(' + x + 'px, ' + y + 'px) }\n';
}
return keyframes;
}

var style = document.createElement('style');
style.textContent = makeKeyframes(numKeyframes, 550, 800);

for (var i = 0; i < N; i++) {
var target = document.createElement('target');
target.style.webkitAnimation = 'anim ' + duration + 'ms linear infinite -' + duration/10 * i/N + 'ms';
container.appendChild(target);
}

container.appendChild(style);

requestAnimationFrame(function() {
measurementReady = true;
});
</script>

<style>
body {
margin: 0;
overflow: hidden;
}
target {
position: absolute;
border: 5px solid green;
border-radius: 100%;
}
container {
position: absolute;
width: 550px;
height: 800px;
background-color: lightgrey;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!doctype html>
<meta name="viewport" content="width=device-width, user-scalable=no">
<container id="container"></container>
<script>
var N = 400;
var numKeyframes = 500;
var duration = 4000;

function makeKeyframes(numKeyframes, width, height) {
var keyframes = '@-webkit-keyframes anim {\n'
for (var i = 0; i < numKeyframes + 1; i++) {
var fraction = i / numKeyframes;
var t = fraction * 2 * Math.PI;
var x = Math.cos(t) - Math.pow(Math.cos(4*t), 3);
x = ((x/4 + 1/2) * width).toFixed(5);
var y = Math.pow(Math.sin(4*t), 3) - Math.sin(2*t);
y = ((y/4 + 1/2) * height).toFixed(5);
keyframes += (fraction*100) + '% { transform: translate(' + x + 'px, ' + y + 'px) }\n';
}
return keyframes;
}

var style = document.createElement('style');
style.textContent = makeKeyframes(numKeyframes, 550, 800);

for (var i = 0; i < N; i++) {
var target = document.createElement('target');
target.style.webkitAnimation = 'anim ' + duration + 'ms linear infinite -' + duration/10 * i/N + 'ms';
container.appendChild(target);
}

container.appendChild(style);

requestAnimationFrame(function() {
measurementReady = true;
});
</script>

<style>
body {
margin: 0;
overflow: hidden;
}
target {
position: absolute;
border: 5px solid green;
border-radius: 100%;
}
container {
position: absolute;
width: 550px;
height: 800px;
background-color: lightgrey;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!doctype html>
<meta name="viewport" content="width=device-width, user-scalable=no">
<container id="container"></container>
<script>
var N = 400;
var numKeyframes = 500;
var duration = 4000;

function makeKeyframes(numKeyframes, width, height) {
var keyframes = '@-webkit-keyframes anim {\n'
for (var i = 0; i < numKeyframes + 1; i++) {
var fraction = i / numKeyframes;
var t = fraction * 2 * Math.PI;
var x = Math.cos(t) - Math.pow(Math.cos(4*t), 3);
x = ((x/4 + 1/2) * width).toFixed(5);
var y = Math.pow(Math.sin(4*t), 3) - Math.sin(2*t);
y = ((y/4 + 1/2) * height).toFixed(5);
keyframes += (fraction*100) + '% { transform: translate(' + x + 'px, ' + y + 'px) }\n';
}
return keyframes;
}

var style = document.createElement('style');
style.textContent = makeKeyframes(numKeyframes, 550, 800);

for (var i = 0; i < N; i++) {
var target = document.createElement('target');
target.style.webkitAnimation = 'anim ' + duration + 'ms linear infinite -' + duration/10 * i/N + 'ms';
container.appendChild(target);
}

container.appendChild(style);

requestAnimationFrame(function() {
measurementReady = true;
});
</script>

<style>
body {
margin: 0;
overflow: hidden;
}
target {
position: absolute;
border: 5px solid green;
border-radius: 100%;
}
container {
position: absolute;
width: 550px;
height: 800px;
background-color: lightgrey;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!doctype html>
<meta name="viewport" content="width=device-width, user-scalable=no">
<container id="container"></container>
<script>
window.measurementReady = true;
var N = 1000;
var duration = 1000;

function startAnimation() {
var target = document.createElement('target');
container.appendChild(target);
}

function startAllAnimations() {
container.textContent = '';
for (var i = 0; i < N; i++) {
startAnimation();
}
}

startAllAnimations();
setInterval(startAllAnimations, duration);
</script>

<style>
target {
display: inline-block;
width: 9px; height: 9px;
background: orange;
-webkit-animation: anim1 1s;
}
@-webkit-keyframes anim1 {
0% { transform: rotate(360deg); }
100% { transform: rotate(0deg); }
}
body {
margin: 0;
overflow: hidden;
}
container {
display: flex;
flex-flow: row wrap;
width: 550px;
height: 800px;
background: magenta;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!doctype html>
<meta name="viewport" content="width=device-width, user-scalable=no">
<container id="container"></container>
<script>
window.measurementReady = true;
var N = 1000;
var duration = 1000;

function startAnimation() {
var target = document.createElement('target');
container.appendChild(target);
}

function startAllAnimations() {
container.textContent = '';
for (var i = 0; i < N; i++) {
startAnimation();
}
}

startAllAnimations();
setInterval(startAllAnimations, duration);
</script>

<style>
target {
display: inline-block;
width: 9px; height: 9px;
background: orange;
-webkit-animation: anim1 1s;
}
@-webkit-keyframes anim1 {
0% { transform: rotate(360deg) translate(1%); }
100% { transform: rotate(0deg) translate(0%); }
}
body {
margin: 0;
overflow: hidden;
}
container {
display: flex;
flex-flow: row wrap;
width: 550px;
height: 800px;
background: magenta;
}
</style>
Loading