cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="portada">
  <!-- <p class="title artists">Mitsuruggy & KUOR Larraz</p>
  <p class="title long-title">La Ley del Salto Dimensional</p> -->
  <ul class="scene" id="scene">
    <!-- Placeholder Cover in case JS is disabled by default -->
    <li class="title layer" data-depth="0.00">
      <svg viewBox="0 0 800 800">
      <text style="stroke: blue; font-size:162.00px; stroke-width: 3px">
        <tspan x="50%" y="45%">LSD</tspan><tspan x="50%" y="50%">TAPE</tspan>
      </text>
    </svg>
    </li>
    <li class="title layer" data-depth="0.29">
      <svg viewBox="0 0 800 800">
      <text style="stroke: #2400da; font-size:185.14px; stroke-width: 3px">
        <tspan x="50%" y="45%">LSD</tspan><tspan x="50%" y="50%">TAPE</tspan>
      </text>
    </svg>
    </li>
    <li class="title layer" data-depth="0.57">
      <svg viewBox="0 0 800 800">
      <text style="stroke: #4800b6; font-size:208.29px; stroke-width: 3px">
        <tspan x="50%" y="45%">LSD</tspan><tspan x="50%" y="50%">TAPE</tspan>
      </text>
    </svg>
    </li>
    <li class="title layer" data-depth="0.86">
      <svg viewBox="0 0 800 800">
      <text style="stroke: #6d0091; font-size:231.43px; stroke-width: 3px">
        <tspan x="50%" y="45%">LSD</tspan><tspan x="50%" y="50%">TAPE</tspan>
      </text>
    </svg>
    </li>
    <li class="title layer" data-depth="1.14">
      <svg viewBox="0 0 800 800">
      <text style="stroke: #91006d; font-size:254.57px; stroke-width: 3px">
        <tspan x="50%" y="45%">LSD</tspan><tspan x="50%" y="50%">TAPE</tspan>
      </text>
    </svg>
    </li>
    <li class="title layer" data-depth="1.43">
      <svg viewBox="0 0 800 800">
      <text style="stroke: #b60048; font-size:277.71px; stroke-width: 3px">
        <tspan x="50%" y="45%">LSD</tspan><tspan x="50%" y="50%">TAPE</tspan>
      </text>
    </svg>
    </li>
    <li class="title layer" data-depth="1.71">
      <svg viewBox="0 0 800 800">
      <text style="stroke: #da0024; font-size:300.86px; stroke-width: 3px">
        <tspan x="50%" y="45%">LSD</tspan><tspan x="50%" y="50%">TAPE</tspan>
      </text>
    </svg>
    </li>
    <li class="title layer" data-depth="2.00">
      <svg viewBox="0 0 800 800">
      <text style="stroke: red; font-size:324.00px; stroke-width: 3px">
        <tspan x="50%" y="45%">LSD</tspan><tspan x="50%" y="50%">TAPE</tspan>
      </text>
    </svg>
    </li>
  </ul>
</div>

<div class="form">
  <form>
    <p>Temas:</p>
    <div class="radios">
      <label for="inicio">
        <input type="radio" name="theme" id="inicio" value="inicio" checked>
        <span>Inicio</span>
      </label>
      <label for="espaciolina">
        <input type="radio" name="theme" id="espaciolina" value="espaciolina">
        <span>Espaciolina</span>
      </label>
      <label for="warp-mind">
        <input type="radio" name="theme" id="warp-mind" value="warp-mind">
        <span>Warp Mind</span>
      </label>
      <label for="invisible">
        <input type="radio" name="theme" id="invisible" value="invisible">
        <span>Invisible</span>
      </label>
      <!-- <label for="iris">
        <input type="radio" name="theme" id="iris" value="iris">
        <span>Arco-Iris</span>
      </label> -->
    </div>
    <br>
    <p>Título:</p>
    <div class="radios">
      <label for="color-red">
        <input type="radio" name="color" id="color-red" value="f00">
        <span>Rojo</span>
      </label>
      <label for="color-green">
        <input type="radio" name="color" id="color-green" value="0f0">
        <span>Verde</span>
      </label>
      <label for="color-blue">
        <input type="radio" name="color" id="color-blue" value="00f">
        <span>Azul</span>
      </label>
      <label for="color-yellow">
        <input type="radio" name="color" id="color-yellow" value="ff0">
        <span>Amarillo</span>
      </label>
      <label for="color-white">
        <input type="radio" name="color" id="color-white" value="fff">
        <span>Blanco</span>
      </label>
      <label for="color-black">
        <input type="radio" name="color" id="color-black" value="000">
        <span>Negro</span>
      </label>
      <label class="valor-color" for="valor-color">
        #<input type="text" name="color" id="valor-color" placeholder="RRGGBB">
        <span style="display:none"></span>
      </label>
    </div>
    <br>
    <p>Fondo:</p>
    <div class="radios">
      <label for="fondo-red">
        <input type="radio" name="fondo" id="fondo-red" value="f00">
        <span>Rojo</span>
      </label>
      <label for="fondo-green">
        <input type="radio" name="fondo" id="fondo-green" value="0f0">
        <span>Verde</span>
      </label>
      <label for="fondo-blue">
        <input type="radio" name="fondo" id="fondo-blue" value="00f">
        <span>Azul</span>
      </label>
      <label for="fondo-yellow">
        <input type="radio" name="fondo" id="fondo-yellow" value="ff0">
        <span>Amarillo</span>
      </label>
      <label for="fondo-white">
        <input type="radio" name="fondo" id="fondo-white" value="fff">
        <span>Blanco</span>
      </label>
      <label for="fondo-black">
        <input type="radio" name="fondo" id="fondo-black" value="000">
        <span>Negro</span>
      </label>
      <label class="valor-fondo" for="valor-fondo">
        #<input type="text" name="fondo" id="valor-fondo" placeholder="RRGGBB">
        <span style="display:none"></span>
      </label>
    </div>
    <br>
    <p>Modo:</p>
    <div class="radios">
      <label for="rgb">
        <input type="radio" name="modo" id="rgb" value="rgb">
        <span>RGB</span>
      </label>
      <label for="lab">
        <input type="radio" name="modo" id="lab" value="lab">
        <span>LAB</span>
      </label>
      <label for="hsl">
        <input type="radio" name="modo" id="hsl" value="hsl">
        <span>HSL</span>
      </label>
      <label for="lch">
        <input type="radio" name="modo" id="lch" value="lch">
        <span>LCH</span>
      </label>
    </div>
    <br>
    <p>Pasos:</p>
    <input id="pasos" type="range" min="0" max="10" step="1" value="6" /><br>
    <p>Grosor Trazo:</p>
    <input id="grosor" type="range" min="1" max="8" step="1" value="3" /><br>
  </form>
  <!--
  <hr>
  <p>Introducción:</p>
  <p></p>
  <hr>
  <p>Instrucciones:</p>
  <ol>
    <li></li>
  </ol>
  <label for="" onclick="guardarComo()">Guardar Como…</label>
-->
  <hr>
  <p>Para disfrutar de la portada necesitas tener JavaScript activado en tu navegador. Aún así, si usas Firefox, Internet Explorer o Edge, es posible que se vea mal 💩.</p>
  <p>Durante estos días iré actualizando la portada para terminar algunas de las cosas que han quedado pendientes y corregir fallos que pueda encontrar ✌️✨.</p>
  <p>Si eres uno de los pobres afectados: deja de llorar, actualiza o cambia de navegador (por desgracia, ahora mismo el único decente es Safari) y/o <a href="https://twitter.com/hack_nug" style="color:white" target="_blank">avísame por Twitter</a> para que
    me ponga a ello 🤖.</p>
</div>
            
          
!
            
              // Fuentes
@font-face
  font-family: "GT Walsheim Bold"
  src: url("https://raw.githack.com/nagypeterjob/nagypeterjob.github.io/master/fonts/GT-Walsheim-Bold.woff")

@font-face
  font-family: "Orbitron"
  src: url("https://raw.githack.com/theleagueof/orbitron/master/webfonts/orbitron-bold-webfont.woff")

// Extras
//*, *:before, *:after
  box-sizing: border-box

hr
  margin-top: 3rem
  margin-bottom: 2rem

// General
html
  max-width: 100vw
  background-color: blue
  color: white
  font-family: "GT Walsheim Bold", Sans-Serif
  font-size: 100%
  line-height: 1

p
  line-height: 1.35

body
  margin: 5vmin
  overflow-x: hidden

// Portada
.portada
  display: inline-block
  position: relative
  height: 90vmin
  width: 90vmin
  box-shadow: 0 0 0 2px white

.title
  left: 0
  right: 0
  margin: 0 auto
  position: absolute
  font-size: 4.5vmin
  text-align: center

.artists
  top: 1em

.long-title
  bottom: 1em

ul
  position: relative
  list-style-type: none
  -webkit-margin-before: 0
  -webkit-margin-after: 0
  -webkit-margin-start: 0
  -webkit-margin-end: 0
  -webkit-padding-start: 0
  width: 100%
  height: 100%

svg
  overflow: visible
  
text
  text-anchor: middle
  fill: none
  cursor: default
  user-select: none

tspan + tspan
  dominant-baseline: hanging

// Formulario
.form
  display: inline-block
  vertical-align: top
  @media (orientation: portrait)
    margin-top: 5vmin
    min-width: 90vmin
    max-width: 90vmin
  @media (orientation: landscape)
    margin-left: 5vmin
    width: calc(100vw - 105vmin - 6px)

form
  //max-width: calc(100vw - 105vmin)
  vertical-align: top

// Formulario: Radio
.radios
  display: flex
  flex-wrap: wrap
  justify-content: flex-start
  margin: 0 -1px

label
  display: flex
  cursor: pointer
  padding: 1rem
  width: auto
  text-align: center
  align-items: center
  justify-content: center
  margin: 0.25rem
  //&:first-of-type
    flex: 2 0 0

// Nuevo
label
  position: relative
  color: white
  box-shadow: 0px 0px 0px 3px blue ,0px 0px 0px 5px white
  &:hover
    background-color: rgba(255,255,255,0.25)

span:after
  position: absolute
  width: 100%
  height: 100%
  left: 0
  top: 0
  z-index: -1
  content: ""

// Hasta aqui

input[type="radio"],
input[type="radio"]:checked
  display: none

// Formulario: Text
input[type="text"]
  background-color: transparent
  color: white
  font-family: inherit
  font-size: 1rem
  border: 0
  padding: 0
  margin: 0
  //max-width: calc(100vw - 105vmin - 6px - 4rem)
  &::placeholder
    color: white
    opacity: 0.5

// Formulario: Range
input[type="range"]
  margin-bottom: 1em
  // removes default webkit styles
  -webkit-appearance: none
  // fix for FF unable to apply focus style bug
  border: 1px solid #ccc
  // required for proper track sizing in FF
  width: 100%
  &::-webkit-slider-runnable-track
    width: 100%
    height: 5px
    background: #ccc
    border: none
  &::-webkit-slider-thumb
    -webkit-appearance: none
    border: none
    height: 1rem
    width: 1rem
    background: white
    margin-top: -0.35rem
  &:focus
    outline: none
    &::-webkit-slider-runnable-track
      background: #ccc
  &::-moz-range-track
    width: 100%
    height: 5px
    background: #ddd
    border: none
  &::-moz-range-thumb
    border: none
    height: 1rem
    width: 1rem
    background: white
  &:-moz-focusring
    outline: 1px solid white
    outline-offset: -1px
  &::-ms-track
    width: 100%
    height: 5px
    /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead
    background: transparent
    /*leave room for the larger thumb to overflow with a transparent border
    border-color: transparent
    border-width: 6px 0
    /*remove default tick marks
    color: transparent
  &::-ms-fill-lower
    background: #777
  &::-ms-fill-upper
    background: #ddd
  &::-ms-thumb
    border: none
    height: 1rem
    width: 1rem
    background: white
  &:focus
    &::-ms-fill-lower
      background: #888
    &::-ms-fill-upper
      background: #ccc
  
li.title.layer
  position: absolute
  display: block
  left: 0px
  top: 0px
            
          
!
            
              var
  pasos = 6,
  grosor = 3,
  t1 = 18,
  t2 = 36,
  color = "f00",
  fondo = "00f",
  modo = "rgb",
  sheet = cssx('main');

// Funciones
function draw() {
  $("ul").empty();
  $("input[type=radio], input[type=text]").parent().css({
    // check hue and change color if too bright
    boxShadow: '0px 0px 0px 3px #' + fondo + ',0px 0px 0px 5px white',
    color: 'white'
  });
  $("input[type=radio]:checked").parent().css({
    backgroundColor: chroma(color).css(),
    color: '#' + fondo
    // check hue and change color if too bright
  });
  for (i = 0; i <= pasos + 1; i++) {
    $('ul').append('<li class="title layer" data-depth="' + (1 / (pasos + 1) * 2 * i).toFixed(2) + '"><svg viewBox="0 0 800 800" ><text style="stroke: ' + chroma.scale(['#' + fondo, '#' + color]).domain([0, pasos + 1]).mode(modo)(i) + '; font-size:' + ((t1 + ((t2 - t1) / (pasos + 1) * i)) * 9).toFixed(2) + 'px; stroke-width: ' + grosor + 'px"><tspan x="50%" y="45%">LSD</tspan><tspan x="50%" y="50%">TAPE</tspan></text></svg></li>');
  };
  updateStyles();
  $scene.parallax('updateLayers');
  changeURLParam('color', color);
  changeURLParam('fondo', fondo);
  changeURLParam('pasos', pasos);
  changeURLParam('modo', modo);
};

// Set styles with CSSX
var updateStyles = function () {
  sheet.add('html', { 'background-color': '#' + fondo });
  sheet.add('label', { 'background-color': 'transparent!important' });
  sheet.add('label:hover', { 'background-color': chroma(color).alpha(0.25).css() + '!important' });
  sheet.add('input:checked + span', { 'color': '#' + fondo });
  sheet.add('input:checked + span:after', { 'background-color': '#' + color });
}

function getURLParameter(name) {
  return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [, ""])[1].replace(/\+/g, '%20')) || null;
}

function changeURLParam(param, value) {
  var currentURL = window.location.href + '&';
  var change = new RegExp('(' + param + ')=(.*)&', 'g');
  var newURL = currentURL.replace(change, '$1=' + value + '&');
  if (getURLParameter(param) !== null) {
    try {
      window.history.replaceState('', '', newURL.slice(0, -1));
    } catch (e) {
      console.log(e);
    }
  } else {
    var currURL = window.location.href;
    if (currURL.indexOf("?") !== -1) {
      window.history.replaceState('', '', currentURL.slice(0, -1) + '&' + param + '=' + value);
    } else {
      window.history.replaceState('', '', currentURL.slice(0, -1) + '?' + param + '=' + value);
    }
  }
};

function resizeForText(text) {
  var $this = $(this);
  if (!text.trim()) {
    text = $this.attr('placeholder').trim();
  }
  var $span = $this.parent().find('span');
  $span.text(text);
  var $inputSize = $span.width();
  $this.css("width", $inputSize + 1);
}

$(window).resize(function() {
  draw();
});

// Busca si los parámetros existen en la URL
if (getURLParameter('color')) {
  color = getURLParameter('color');
};

if (getURLParameter('fondo')) {
  fondo = getURLParameter('fondo');
};

if (getURLParameter('pasos')) {
  pasos = parseInt(getURLParameter('pasos'));
  $('#pasos').value = pasos;
};

if (getURLParameter('modo')) {
  modo = getURLParameter('modo');
};

// Guarda los parámetros inciales
var color_bk = color;
var fondo_bk = fondo;
var pasos_bk = pasos;
var modo_bk = modo;

// Inicializa la escena
var $scene = $('#scene').parallax();
draw();

// Debuger
// $('label').append('<p>' + $("input[name='color']").parent().htmlFor() + '</p>');

// Plantillas predeterminadas
// Esto debería/podría usar clases
$('input[name=theme]').change(function() {
  if (this.value == "inicio") {
    if (color_bk) color = color_bk;
    if (fondo_bk) fondo = fondo_bk;
    if (pasos_bk) pasos = pasos_bk;
    if (modo_bk) modo = modo_bk;
  };
  if (this.value == "espaciolina") {
    color = "f00";
    fondo = "00f";
    modo = "rgb";
  };
  if (this.value == "warp-mind") {
    color = "fff";
    fondo = "6e32ff";
    modo = "rgb";
  };
  if (this.value == "invisible") {
    color = "ddd";
    fondo = "fff";
    modo = "rgb";
  };
  if (this.value == "iris") {
    color = "ff0";
    color2 = "77f";
    fondo = "000";
    modo = "hsl";
  };
  draw();
});

// Funciones interacción
$('input[name=color]').change(function() {
  color = $("input[name=color]:checked").val();
  draw();
});

$('input[name=fondo]').change(function() {
  fondo = $("input[name=fondo]:checked").val();
  draw();
});

$('input[name=modo]').change(function() {
  modo = $("input[name=modo]:checked").val();
  draw();
});

$("input[name=color]:checked").parent().css({
  backgroundColor: "#" + color,
  color: "#" + fondo
});

// Calcula la anchura de los inputs de texto
var $inputs = $(".valor-color, .valor-fondo");

$inputs.find('input').keypress(function(e) {
  if (e.which && e.charCode) {
    var c = String.fromCharCode(e.keyCode | e.charCode);
    var $this = $(this);
    resizeForText.call($this, $this.val() + c);
  }
});

$inputs.find('input').keyup(function(e) {
  if (e.keyCode === 8 || e.keyCode === 46) {
    resizeForText.call($(this), $(this).val());
  }
});

$inputs.find('input').each(function() {
  var $this = $(this);
  resizeForText.call($this, $this.val())
});

// Actualiza Color al input
$('#valor-color').on('input', function() {
  if (/(^#?(([A-F0-9]){3}){1,2}$$)/i.test(this.value)) {
    color = (this.value);
    draw();
  }
});

$('#valor-fondo').on('input', function() {
  if (/(^#?(([A-F0-9]){3}){1,2}$$)/i.test(this.value)) {
    fondo = (this.value);
    draw();
  }
});

// Actualiza Pasos y Grosor al input
$('#pasos').on('input', function() {
  pasos = parseInt(this.value);
  draw();
});

$('#grosor').on('input', function() {
  grosor = parseInt(this.value);
  draw();
});

function guardarComo () {
  html2canvas($(".portada"), {
    onrendered: function(canvas) {
      document.body.appendChild(canvas);
    },
  });
};
            
          
!
999px
Loading ..................

Console