js实现可鼠标拖动手写手绘果冻抖动文字效果代码

代码语言:html

所属分类:拖放

代码描述:js实现可鼠标拖动手写手绘果冻抖动文字效果代码

代码标签: js 手写 手绘 果冻 抖动 文字 拖动 鼠标

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">



<style>
    @font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: normal;
  src: url(https://fonts.gstatic.com/s/opensans/v40/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4gaVc.ttf) format('truetype');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: normal;
  src: url(https://fonts.gstatic.com/s/opensans/v40/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsgH1x4gaVc.ttf) format('truetype');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 800;
  font-stretch: normal;
  src: url(https://fonts.gstatic.com/s/opensans/v40/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgshZ1x4gaVc.ttf) format('truetype');
}
html,
body {
  width: 100%;
  height: 100%;
}
body {
  margin: 0px;
  overflow: hidden;
  color: white;
  font-family: "Open Sans", sans-serif;
}
#wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.2s ease-in-out;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
#wrapper.wrapped {
  transform: translateX(300px);
}
#wrapper.wrapped .canvas:before {
  opacity: 1;
  visibility: visible;
  transition: visibility 0s, opacity 0.5s ease-in-out;
}
#wrapper .controls {
  background-color: #5BC0EB;
  width: 300px;
  height: 100%;
  position: absolute;
  left: -300px;
  overflow-y: auto;
}
#wrapper .controls::-webkit-scrollbar {
  width: 4px;
}
#wrapper .controls::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
}
#wrapper .controls section {
  margin: 0 15px;
  font-weight: 600;
  font-size: 12px;
}
#wrapper .controls section h1 {
  text-indent: -2px;
}
#wrapper .controls section h2,
#wrapper .controls section h3 {
  text-indent: -1px;
}
#wrapper .controls label {
  font-weight: 300;
  text-transform: uppercase;
}
#wrapper .controls label span {
  font-weight: 800;
}
#wrapper .controls p {
  color: rgba(255, 255, 255, 0.75);
}
#wrapper .controls p strong {
  color: white;
}
#wrapper .canvas {
  width: 100%;
  height: 100%;
  position: relative;
  background-color: white;
  transform: translateX(0);
  transition: transform 0.2s ease-in-out;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
  color: #2D3047;
  touch-action: none;
}
#wrapper .canvas:before {
  content: '';
  position: absolute;
  z-index: 1;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: visibility 0s linear 0.5s, opacity 0.5s ease-in-out;
}
#wrapper .canvas a {
  color: #2D3047;
}
#wrapper .canvas a:hover {
  color: #464960;
}
#wrapper .canvas canvas {
  position: absolute;
  width: 100%;
  height: 100%;
}
.form-group-vertical {
  display: inline-block;
}
.form-group-vertical label span {
  display: block;
  font-size: 10px;
  text-align: center;
  font-weight: 600;
}
.form-control {
  border-radius: 2px;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}
.form-control[type="number"] {
  width: 48px;
  font-size: 9px;
  padding: 4px;
  height: auto;
}
.btn {
  border-radius: 2px;
}
.btn.btn-wide {
  width: 100%;
}
.slider {
  width: 100%;
  position: relative;
  cursor: ew-resize;
  padding: 6px 0;
  height: 16px;
}
.slider .slider-track {
  position: absolute;
  height: 4px;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.2);
}
.slider .slider-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: white;
  transition: transform 0.2s cubic-bezier(0.34, 1.61, 0.7, 1);
  left: 0;
  margin: -6px 0 0 -8px;
  transform: scale(1);
}
.slider .slider-thumb:hover {
  transform: scale(1.5);
}
.slider.slider-vertical {
  padding: 0 6px;
  height: 100px;
  cursor: ns-resize;
  width: 16px;
  margin: 0px auto;
}
.slider.slider-vertical .slider-track {
  width: 4px;
  height: 100%;
}
.slider.slider-vertical .slider-thumb {
  left: auto;
  bottom: 0;
  margin: 0 0 -8px -6px;
}
label.toggle {
  cursor: pointer;
  width: 32px;
  height: 16px;
  display: block;
  position: relative;
  margin: 0px;
  padding: 6px 0;
}
label.toggle input {
  display: none;
}
label.toggle .toggle-track {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.34, 1.61, 0.7, 1);
}
label.toggle .toggle-track .toggle-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 24px;
  background-color: #FFFFFF;
  left: 0px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.61, 0.7, 1);
  top: 0;
  margin-left: -8px;
}
label.toggle input:checked + .toggle-track {
  background-color: rgba(255, 255, 255, 0.8);
}
label.toggle input:checked + .toggle-track .toggle-thumb {
  left: 100%;
  background-color: #ffffff;
}
label.toggle:hover .toggle-thumb {
  transform: scale(1.5);
}
.quick {
  position: absolute;
  top: 22px;
  right: 25px;
  z-index: 1;
}
.quick a {
  font-size: 25px;
  display: block;
}
.quick .slider .slider-track {
  background-color: rgba(45, 48, 71, 0.2);
}
.quick .slider .slider-thumb {
  background-color: #2D3047;
}
.quick .form-group-vertical {
  width: 100%;
}
body.has-shader canvas#render {
  filter: url('#filter');
  -webkit-filter: url('#filter');
}
body.has-night #wrapper .controls {
  background-color: #FFFFFF;
  color: #2D3047;
}
body.has-night #wrapper .controls::-webkit-scrollbar-thumb {
  background-color: rgba(45, 48, 71, 0.2);
}
body.has-night #wrapper .controls p {
  color: rgba(45, 48, 71, 0.8);
}
body.has-night #wrapper .controls p strong {
  color: #2D3047;
}
body.has-night #wrapper .canvas {
  background-color: #2D3047;
  color: rgba(255, 255, 255, 0.75);
}
body.has-night #wrapper .canvas a {
  color: rgba(255, 255, 255, 0.75);
}
body.has-night #wrapper .canvas a:hover {
  color: white;
}
body.has-night #wrapper .canvas:before {
  background-color: rgba(0, 0, 0, 0.2);
}
body.has-night .form-control {
  border-color: rgba(45, 48, 71, 0.2);
}
body.has-night .slider .slider-track {
  background-color: rgba(45, 48, 71, 0.2);
}
body.has-night .slider .slider-thumb {
  background-color: #2D3047;
}
body.has-night label.toggle .toggle-track {
  background-color: rgba(45, 48, 71, 0.2);
}
body.has-night label.toggle .toggle-track .toggle-thumb {
  background-color: #2D3047;
}
body.has-night label.toggle input:checked .toggle-track {
  background-color: rgba(45, 48, 71, 0.8);
}
body.has-night .quick .slider .slider-track {
  background-color: rgba(255, 255, 255, 0.2);
}
body.has-night .quick .slider .slider-thumb {
  background-color: white;
}
</style>
</head>

<body>

    <div id="wrapper">
        <div class="controls">
            <section>
                <h2>Options</h2>
                <div class="form-group">
                    <label for="preset">Preset(s) <span></span></label>
                    <select class="form-control" id="preset">
				</select>
                </div>
                <div class="form-group">
                    <label for="composite">Compositing <span></span></label>
                    <select class="form-control" id="composite" data-config="composite">
				</select>
                </div>
                <div class="form-group">
                    <label for="night">Nightmode <span></span></label>
                    <label class="toggle" for="night">
					<input type="checkbox" id="night">
					<div class="toggle-track">
						<div class="toggle-thumb"></div>
					</div>
				</label>
                </div>
            </section>
            <section>
                <h3>Animation</h3>
                <p>Lorem ipsum dolor sit amet, <strong>consectetur</strong> adipisicing elit.</p>
                <div class="form-group">
                    <label for="scale">Scale <span></span></label>
                    <div class="slider" data-min="0" data-max="100" data-accuracy="2">
                        <input type="hidden" id="scale" data-config="scale" />
                        <div class="slider-track"></div>
                        <div class="slider-thumb"></div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="speed">Speed <span></span></label>
                    <div class="slider" data-min="-5" data-max="5" data-accuracy="2">
                        <input type="hidden" id="speed" value="0" data-config="speed" />
                        <div class="slider-track"></div>
                        <div class="slider-thumb"></div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="linewidth">Line width <span></span></label>
                    <div class="slider" data-min="1" data-max="50" data-accuracy="0">
                        <input type="hidden" id="linewidth" data-config="linewidth" />
                        <div class="slider-track"></div>
                        <div class="slider-thumb"></div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="layers">Layers <span></span></label>
                    <div class="slider" data-min="1" data-max="10" data-accuracy="0">
                        <input type="hidden" id="layers" data-config="layers" />
                        <div class="slider-track"></div>
                        <div class="slider-thumb"></div>
                    </div>
                </div>
            </section>
            <section>
                <h3>Filter</h3>
                <div class="form-group">
                    <label for="shader">Enable <span></span></label>
                    <label class="toggle" for="shader">
					<input type="checkbox" id="shader">
					<div class="toggle-track">
						<div class="toggle-thumb"></div>
					</div>
				</label>
                </div>
                <div class="form-group">
                    <label for="blur">Blur radius <span></span></label>
                    <div class="slider" data-min="1" data-max="50" data-accuracy="0">
                        <input type="hidden" id="blur" data-config="blur" value="10" />
                        <div class="slider-track"></div>
                        <div class="slider-thumb"></div>
                    </div>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="rr">RR</label>
                    <input class="form-control" id="rr" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="rg">RG</label>
                    <input class="form-control" id="rg" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="rb">RB</label>
                    <input class="form-control" id="rb" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="ra">RA</label>
                    <input class="form-control" id="ra" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="r1">R1</label>
                    <input class="form-control" id="r1" type="number" step="0.1" value="0" data-shader>
                </div>
                <br>
                <div class="form-group form-group-vertical">
                    <label for="gr">GR</label>
                    <input class="form-control" id="gr" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="gg">GG</label>
                    <input class="form-control" id="gg" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="gb">GB</label>
                    <input class="form-control" id="gb" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="ga">GA</label>
                    <input class="form-control" id="ga" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="g1">G1</label>
                    <input class="form-control" id="g1" type="number" step="0.1" value="0" data-shader>
                </div>
                <br>
                <div class="form-group form-group-vertical">
                    <label for="br">BR</label>
                    <input class="form-control" id="br" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="bg">BG</label>
                    <input class="form-control" id="bg" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="bb">BB</label>
                    <input class="form-control" id="bb" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="ba">BA</label>
                    <input class="form-control" id="ba" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="b1">B1</label>
                    <input class="form-control" id="b1" type="number" step="0.1" value="0" data-shader>
                </div>
                <br>
                <div class="form-group form-group-vertical">
                    <label for="ar">AR</label>
                    <input class="form-control" id="ar" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="ag">AG</label>
                    <input class="form-control" id="ag" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="ab">AB</label>
                    <input class="form-control" id="ab" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="aa">AA</label>
                    <input class="form-control" id="aa" type="number" step="0.1" value="0" data-shader>
                </div>
                <div class="form-group form-group-vertical">
                    <label for="a1">A1</label>
                    <input class="form-control" id="a1" type="number" step="0.1" value="0" data-shader>
                </div>
            </section>
            <section>
                <div class="form-group">
                    <button class="btn btn-success btn-wide trigger-save"><i class="fa fa-floppy-o"></i> Save as...</button>
                </div>
            </section>
        </div>
        <div class="canvas">
            <div class="quick">
                <a href="#" class="trigger-menu"><i class="fa fa-cogs"></i></a>
                <a href="#" class="trigger-clear"><i class="fa fa-eraser"></i></a>

                <div class="form-group-vertical">
                    <label for="linewidth"><a href="#"><i class="fa fa-paint-brush">&l.........完整代码请登录后点击上方下载按钮下载查看

网友评论0