Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="./assets/css/app.css">
    <title>JS Lab - Joseph AZAR</title>
</head>
<body>
    <!-- <canvas id="canvas" height="600" hidpi="off"></canvas> 
     -->
    <div class="infos">
        <h1>Day 122</h1>
        </div>
 
    <!-- Main Script -->
    <script src="./assets/js/app-dist.js"></script>
</body>
</html>

              
            
!

CSS

              
                h1, h2 {
  font-family: Arial;
  font-size: 20px;    
  top:16px;
  left:20px;
  color: white;
  margin : 0;
}
p {
    color:white;
    font-size:16px;
}
a {
    text-decoration:none;
    color:white;
    text-decoration: underline;
}
/*************************/
// couleurs été
@vert: #2fa398;
@bleu: #0067ca;
@gris:#9881ab;
@rose:#d276a5;
@rouge:#8f1840;
@mauve:#b4387e;
@purple:#826bb1;
@sombre:#211b27;
// dégradés
@dark-radiant: linear-gradient(45deg, #171b26 0%,#283144 99%);
/** CANVAS **/
canvas {
    // background-color: #211b27;
    position: absolute;
    left: 0px;
    right: 0;
    margin: 0px;
    top:0px;
    z-index: 0;
    background-color: @sombre;
}
body {
  padding: 0;
  margin:0;
  position: relative;
  background-color: @sombre;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: white;
}
.infos {
    position: absolute;
    z-index: 10;
    padding : 20px;
}
              
            
!

JS

              
                //creation du contexte 2D
w = window.innerWidth;
h = window.innerHeight;
var ctx = getContext(w, h);
var canvas = ctx.canvas;
document.body.appendChild(canvas);
canvas.width = w;
canvas.height = h;

let cx = w / 2;
let cy = h / 2;
let G = new Graphics(ctx);
let mousePoint = new Point(0, 0);
ctx.strokeStyle = "#9881ab";

/**
TUTOS de Nicolas BARRADEAU : 
YOUPI.IO

Ici on va parler Coordonnées Polaires
Radiale + Angulaire
**/

function draw() {
  requestAnimationFrame(draw)
  ctx.restore();
  ctx.save();
  ctx.clearRect(0, 0, w, h);

  ctx.translate(cx,cy)
  
  ctx.fillStyle = "white";
  // convertir l'angle en radian
  var radians = Math.PI / 180;
  //donc 30 ° en radians =
  //var angle = 30 * radians;
  //on définit un rayon
  var rayon = h/3;

  // centre du canvas
  G.disc(0,0,2);
  // et on les convertit en X Y comme suit
  let nbCercle = 24;
  // distribtion en spirales
  // on va faire 2 tours : 
  var mouseXNorm = normalise(mousePoint.x, 0,w);
  var turns = mouseXNorm * 10
  //var turns = 3;
  // l'angle en radians
  var finalAngle = Math.PI * 2 * turns;
  // et on spécifie le pas (de combien les points sont espacés en radians)
	step = 5 * radians;
  
  for (angle = 0; angle < finalAngle; angle+= step) {    
    	//le rayon augmente en fonction de l'angle 
			r = rayon * (angle / finalAngle);
			//convertit en coordonnées cartésiennes et dessine
			x = Math.cos(angle) * r;
			y = Math.sin(angle) * r;
			G.circle(x, y, 1);
  }
}
draw();
document.addEventListener("mousemove", e => {
  mousePoint.x = e.clientX - 25;
  mousePoint.y = e.clientY - 25;
});
              
            
!
999px

Console