JSFiddle - React, Tailwind, and code Playground

by Eugene Krevenets

HTML

<div id="topElement"></div>
<textArea id="text" cols="10" rows="10" class="text"></textArea>

CSS

.text {
    position: absolute;
    
    font-size: 13px;
    line-height: 20px;
    resize: none;

    border: 2px solid #c2ccd7;
    border-radius: 5px;
    box-shadow: inset 2px 2px 6px 2px #f1f1f1;

    padding: 4px 8px 4px 8px;
    margin: 0;
    height: 124px;
    width: 100%;
    outline: none;

    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
    -moz-box-sizing: border-box;    /* Firefox, other Gecko */
    box-sizing: border-box;         /* Opera/IE 8+ */
}

body {
    background-color: black;
}

JavaScript

var topElement = document.querySelector('#topElement');
text.value = 'Hello World!'

var updatePosition = function() {
    topElement.style.height = 120 +  ~~50 * Math.sin(0.002 * Date.now()) + 'px';
    setTimeout(updatePosition, 1000/60)
}

updatePosition();