Visualizing CSS Transforms

Size
3,155 Kb
Views
44,528

How do I make an visualizing css transforms?

A tool for visualizing how transform functions work and why the order used actually matters.. What is a visualizing css transforms? How do you make a visualizing css transforms? This script and codes were developed by Aaron Gustafson on 13 August 2022, Saturday.

Visualizing CSS Transforms Previews

Visualizing CSS Transforms - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Visualizing CSS Transforms</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1 id="test">Dissecting Transforms</h1>
<p>Drop in a CSS3 transform stack and see how it gets created. Then rearrange and try again. This is especially useful when working with <code>translate</code> and <code>rotate</code> functions or when you are working in 3D.</p>
<noscript> <p>Unfortunately, this tool requires JavaScript.</p>
</noscript> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Visualizing CSS Transforms - Script Codes CSS Codes

body { padding: 1em; -webkit-perspective: 500px; perspective: 500px;
}
label { font-weight: bold;
}
textarea { display: block; margin: .5em 0; width: 400px; height: 200px;
}
button { margin-right: .5em;
}
p { width: 400px;
}
.target { background: #ccc; border: 5px solid; border-radius: 10px; color: #000; width: 190px; height: 190px; margin: -100px 0 0 -100px; position: absolute; top: 50%; left: 50%; -moz-transition: -moz-transform 1s, opacity 1s; -ms-transition: -ms-transform 1s, opacity 1s; -webkit-transition: -webkit-transform 1s, opacity 1s; -o-transition: -o-transform 1s, opacity 1s; transition: transform 1s, opacity 1s;
}

Visualizing CSS Transforms - Script Codes JS Codes

(function($){ var transforms = [], stack = '', interval, $body = $('body'), $target = $('<div class="target"/>'), $current_target = $([]), $form = $('<div id="form"/>'), $label = $('<label for="transform">Transform Stack</label>').appendTo($form), $transform = $('<textarea id="transform">translateX(50px) rotate(45deg) translateY(80px)</textarea>') .appendTo($form), $button = $('<button>Show Me</button>') .click(apply) .appendTo( $form.appendTo( $body ) ), $rearrange = $('<button>Rearrange</button>') .click(rearrange) .appendTo( $form ); function apply() { if ( $current_target.length ) { $current_target.css('opacity',.35); } transforms = $transform.val().replace(/[\s\r\n]+/g,' ').split(' '); stack = ''; $current_target = $target.clone().appendTo( $body ); interval = setInterval(transform,1000); } function transform(){ if ( transforms.length ) { stack += '' + transforms.shift(); $current_target.css({ '-moz-transform': stack, '-ms-transform': stack, '-webkit-transform': stack, '-o-transform': stack, 'transform': stack }); } else { clearInterval(interval); } } function rearrange() { var array = $transform.val().replace(/[\s\r\n]+/g,' ').split(' '), index = array.length, temp, random; // While there remain elements to shuffle... while ( 0 !== index ) { // Pick a remaining element... random = Math.floor(Math.random() * index); index -= 1; // And swap it with the current element. temp = array[index]; array[index] = array[random]; array[random] = temp; } $transform.val( array.join(' ') ); }
})(jQuery);
Visualizing CSS Transforms - Script Codes
Visualizing CSS Transforms - Script Codes
Home Page Home
Developer Aaron Gustafson
Username aarongustafson
Uploaded August 13, 2022
Rating 3.5
Size 3,155 Kb
Views 44,528
Do you need developer help for Visualizing CSS Transforms?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Aaron Gustafson (aarongustafson) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!