1

Fourier [css] Transform

 2 years ago
source link: https://codepen.io/bgoonz/pen/MWpRXzb
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
0 unsaved changes
xxxxxxxxxx
<div id="container" class="container"></div>

CSS (SCSS)

CSS (SCSS)

$canvas-count: 10;
$canvas-width: 400px;
$animation-dur: 2s;
html, body {
  height: 100%;
}
body {
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 5000px;
}
.container {
  position: relative;
  width: $canvas-width;
  height: $canvas-width;
  background: rgba(black, .05);
  transition: all $animation-dur;
  transform-style: preserve-3d;
  animation: container 6s 1s 1;

JS (Babel)

JS (Babel)

xxxxxxxxxx
var canvasCount = 10
var canvasWidth = 400
function drawSin(ctx, waveLength, x = 1, y) {
  var i = 0
  while (i++ < x) {
    ctx.fillRect(
      i,
      y + Math.sin((i / waveLength)) * waveLength,
      1, 1
    )
  }
}
var canvases = new Array(canvasCount)
  .join(' ')
  .split(' ')
  .map((c, i) => {
    var canvas = document.createElement('canvas')
    canvas.width = canvasWidth
    canvas.height = canvasWidth
    container.appendChild(canvas)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK