Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                section
  .special.split.snake 500
  .special.split.wave Infernal error
              
            
!

CSS

              
                :root
	--bgColor #1b1819
	--color #e81b3e
*
	box-sizing border-box
      
body
	background-color var(--bgColor)
	width 100vw
	height 100vh
	position absolute
	top 0
	left 0
	display block
	padding 0
	margin 0
	overflow hidden
	text-align center

	section
		font-family 'Cheee'
		font-variation-settings 'yest' 0.0, 'gvty' 0.0
		width 100%
		margin 27vh auto
		display inline-block

		.special
			&.split
				color inherit
				> div
					transform-origin 50% 50%
					will-change font-variation-settings

				&.snake
					line-height 1em
					color var(--color)
					font-size 35vw
					text-shadow 0 0 3vw

				&.wave
					line-height 1em
					color var(--color)
					font-size 9.5vw
					margin-top -0.8em
					text-shadow 0 0 3vw

              
            
!

JS

              
                var win, container, stats;
//-
$(document).ready(function($) {
	win = $(window);

	var splits = [];
	splits.push( new SplitFont( $('section .special.split.snake'), 0.02 ) );
	splits.push( new SplitFont( $('section .special.split.wave'), 0.15 ) );
	//-
	function animate() {
		requestAnimationFrame( animate );
		$.each(splits, function(_i, _split ){
			_split.render();
		});
	}
	animate();
});


//- FONT -
var SplitFont = function( _element, _vel ){
	var t = this;
	t.el = $(_element);
	t.splitText = new SplitText( t.el, {type:"chars"});
	t.numChars = t.splitText.chars.length;
	t.type = t.el.hasClass('snake') ? 'snake' : t.el.hasClass('wave') ? 'wave' : '';
	t.chars = []; 
	
	//- Animation
	t.iniWght   = 0;
	t.finWght   = 1000;
	t.yest      = 0;
	t.increase  = (Math.PI * 2 / t.numChars );
	t.vel  		= _vel;
	
	//-
	t.radius = 190;
	//-
	for(var i = 0; i < t.numChars; i++){
		var char = $(t.splitText.chars[i]);
		var text = char.text();
		char.data('counter', (t.increase * i) );
	}
 
  	t.render = function(){
		for(var i = 0; i < t.numChars; i++){
			var char = $(t.splitText.chars[i]);
			var wght = t.iniWght + ( (t.finWght - t.iniWght) * (Math.sin( char.data('counter') ) / 2 + 0.5 ));
			switch( t.type ){
				case 'wave':
					char.css('font-variation-settings', '"yest" '+t.yest+', "gvty" '+wght );
					break;
					
				case 'snake':
				default: 
					char.css('font-variation-settings', '"yest" '+wght+', "gvty" 400' );
					break;
			}
			char.data('counter', char.data('counter') - (t.increase * t.vel) );
		}
	};
};
              
            
!
999px

Console