Scale Demo

Developer
Size
3,214 Kb
Views
14,168

How do I make an scale demo?

This is used to embed in my blog http://agelber.com/blog/2d-transforms. What is a scale demo? How do you make a scale demo? This script and codes were developed by Assaf Gelber on 03 January 2023, Tuesday.

Scale Demo Previews

Scale Demo - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Scale Demo</title> <script src="https://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ @import 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:300';
body { margin-top: 50px; overflow: hidden; font-family: Source Sans Pro;
}
#element { box-sizing: border-box; position: absolute; left: 250px; width: 100px; height: 100px; background: #387FF2; border: 3px solid #444; margin: 0 auto;
}
.slider, #css { position: relative;
}
.slider label, #css label { display: inline-block; width: 12px;
}
.slider input, #css input { vertical-align: middle;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div id='element'></div>
<div class='slider'> <label>X:</label> <input id='xslider' max='2.5' min='0' step='0.1' type='range' value='1'>
</div>
<div class='slider'> <label>Y:</label> <input id='yslider' max='2.5' min='0' step='0.1' type='range' value='1'>
</div>
<div id='css'>transform: scaleX(1) scaleY(1)</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Scale Demo - Script Codes CSS Codes

@import 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:300';
body { margin-top: 50px; overflow: hidden; font-family: Source Sans Pro;
}
#element { box-sizing: border-box; position: absolute; left: 250px; width: 100px; height: 100px; background: #387FF2; border: 3px solid #444; margin: 0 auto;
}
.slider, #css { position: relative;
}
.slider label, #css label { display: inline-block; width: 12px;
}
.slider input, #css input { vertical-align: middle;
}

Scale Demo - Script Codes JS Codes

var el = document.getElementById('element'), css = document.getElementById('css'), x = 1, y = 1;
document.getElementById('xslider').addEventListener('change', function() { x = this.value; update();
}, false);
document.getElementById('yslider').addEventListener('change', function() { y = this.value; update();
}, false);
function update() { var prop = 'scaleX(' + x + ') scaleY(' + y + ')'; el.style[Modernizr.prefixed('transform')] = prop; css.innerText = 'transform: ' + prop;
}
Scale Demo - Script Codes
Scale Demo - Script Codes
Home Page Home
Developer Assaf Gelber
Username agelber
Uploaded January 03, 2023
Rating 3
Size 3,214 Kb
Views 14,168
Do you need developer help for Scale Demo?

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!

Assaf Gelber (agelber) Script Codes
Create amazing art & images 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!