Fully Furnished
How do I make an fully furnished?
A prototype experimenting placing objects overlaying an image.. What is a fully furnished? How do you make a fully furnished? This script and codes were developed by Coran Spicer on 15 October 2022, Saturday.
Fully Furnished - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Fully Furnished</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="bare-floorplan"> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/23594/rough-draft-bare-floorplan.jpg" />
</div>
<form id="add-furniture"> <select id="furniture-selection"></select> <a href="#">Add piece of Furniture</a>
</form>
<script> var furnitureJSON = {'furniture' :[ {"name":"Bed", "src":"https://s3-us-west-2.amazonaws.com/s.cdpn.io/23594/bed.png"}, {"name":"Chaise", "src":"https://s3-us-west-2.amazonaws.com/s.cdpn.io/23594/chaise.png"}, {"name":"Dresser", "src":"https://s3-us-west-2.amazonaws.com/s.cdpn.io/23594/dresser.png"}, {"name":"Floor Vase", "src":"https://s3-us-west-2.amazonaws.com/s.cdpn.io/23594/floor-vase.png"}, {"name":"Large Chest", "src":"https://s3-us-west-2.amazonaws.com/s.cdpn.io/23594/large-chest.png"}, {"name":"Night Stand", "src":"https://s3-us-west-2.amazonaws.com/s.cdpn.io/23594/night-stand.png"}, {"name":"Vanity", "src":"https://s3-us-west-2.amazonaws.com/s.cdpn.io/23594/vanity.png"}
]};
</script> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://code.interactjs.io/interact-1.2.2.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Fully Furnished - Script Codes CSS Codes
.bare-floorplan { display: block; position: relative; overflow: hidden; width: 100%;
}
.bare-floorplan img { display: block; position: relative; margin: 0 auto;
}
.bare-floorplan img.draggable-furniture { display: block; position: absolute; top: 0; left: 0; -moz-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0);
}
#add-furniture { position: absolute; top: 5%; right: 5%; padding: 1rem; background-color: darkorange;
}
#add-furniture a { display: inline-block; font-family: sans-serif; text-decoration: none; color: lemonchiffon; font-size: .8rem;
}
#add-furniture a:hover { color: white;
}
Fully Furnished - Script Codes JS Codes
'use strict';
// prototype of a floorplan with placeable furniture
// uses interact.js http://interactjs.io
// create a select from the furniture json
var optionHTML;
var furnitureCollection = furnitureJSON.furniture;
for ( var piece in furnitureCollection ) { optionHTML += '<option value=' + furnitureCollection[piece].src + '>' +furnitureCollection[piece].name + '</option>';
}
$('#furniture-selection').html(optionHTML);
$('#add-furniture a').on('click', function(e){ e.preventDefault(); var currentPiece = $('#furniture-selection').val(); var uniqueID = createUID(); $('<img/>', { 'src' : currentPiece, 'class' : 'draggable-furniture', 'id' : uniqueID, 'data-top' : 0, 'data-left' : 0, 'data-rotate' : 0 }) .appendTo( '.bare-floorplan' ); // set up draggable interact('#'+uniqueID).draggable({ inertia: true, restrict: { restriction: "parent", endOnly: true, elementRect: { top: 0, left: 0, bottom: 1, right: 1 } }, ondoubletap: function (e) { e.preventDefault(); console.log( 'rotate me!' ); }, onmove: function(e) { var target = e.target, // keep the dragged position in the data-x/data-y attributes x = (parseFloat(target.getAttribute('data-x')) || 0) + e.dx, y = (parseFloat(target.getAttribute('data-y')) || 0) + e.dy; target.style.webkitTransform = target.style.transform = 'translate(' + x + 'px, ' + y + 'px)'; target.setAttribute('data-x', x); target.setAttribute('data-y', y); } }); /* going to have to use greensock for the translation and rotations because transform needs a matrix definition! .on('doubletap', function (e) { var target = e.target; e.preventDefault(); var dataDeg = target.getAttribute('data-rotate'); console.log( dataDeg ); var currentDeg = dataDeg.substring( 0, dataDeg.indexOf('deg') ); var newDeg = ( currentDeg + 90 ) === 360 ? 0 : currentDeg + 90; target.style.webkitTransform = target.style.transform = 'rotate('+newDeg+'deg)'; }); */
});
function createUID() { var text = ''; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for( var i=0; i<5; i++ ) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text;
}

Developer | Coran Spicer |
Username | cgspicer |
Uploaded | October 15, 2022 |
Rating | 3 |
Size | 3,613 Kb |
Views | 10,115 |
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!
Name | Size |
Fruit Stripe Background | 2,758 Kb |
Promise example | 2,343 Kb |
SMITE spinner | 2,508 Kb |
ExamplesEdit | 1,592 Kb |
Header logo that changes | 2,031 Kb |
A Pen by Coran Spicer | 2,815 Kb |
Donatello Sprite | 2,452 Kb |
Tile with special tiles experiment | 1,952 Kb |
Aaronmarino.com v2 styles | 2,863 Kb |
BuildUp | 3,509 Kb |
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!
Name | Username | Size |
The Monty Hall Problem | Melatonind | 4,360 Kb |
RPG Style Text Dialogue | Odylic | 2,635 Kb |
CMP5-Opdracht15 | SannevanGastel | 2,733 Kb |
Responsive Boxes without Images | Andymcfee | 4,120 Kb |
Vanilla JS - A toggleClass function | Woodwork | 2,532 Kb |
Blockquote design | Sjmcpherson | 1,863 Kb |
HTM5 picture dropzone | Jaysalvat | 2,576 Kb |
Full page table inside the grid | Twikito | 1,864 Kb |
RAQuote | Naderk007 | 4,412 Kb |
Cloudy Spiral CSS animation | Hakimel | 6,587 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!