cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

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.

              <h1>Experiments with HTML5</h1>
			<li><a href="https://www.html5rocks.com/en/tutorials/webcomponents/customelements/">Custom elements</a>. I want a custom-made syntactic html! I want my own tags with behaviour and style!
			<li><a href="https://www.html5rocks.com/en/tutorials/webcomponents/template/">Templates</a>. No more script type="template/x-handlebars-template" hack. Now we have Template html tag.
			<li><a href="https://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/">Shadow DOM</a>. Each tile have its own CSS. And the page CSS does not affect the tiles. See the backgounds!
			<li><a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">Flexbox</a>. I do not want space between the tiles!
			<li><a href="https://greensock.com/gsap">GSAP</a>. Because I want some animations.

		<template id="tile">
				div {
					border: 3px solid black; 
					width: 256px; height: 256px; 
					background-color: red; }
			<div><img src="https://falicov.soluciones3f.com.ar/assets/texture.png" /></div>

		<div id="container">
			<s3f-tile back-image="https://falicov.soluciones3f.com.ar/assets/spade.png"></s3f-tile>
			<s3f-tile back-image="https://falicov.soluciones3f.com.ar/assets/heart.png"></s3f-tile>
			<s3f-tile back-image="https://falicov.soluciones3f.com.ar/assets/club.png"></s3f-tile>
			<s3f-tile back-image="https://falicov.soluciones3f.com.ar/assets/diamond.png"></s3f-tile>
              div { background-color: blue !important; }
			#container { 
				display: flex; flex-flow: row wrap; 
				width: 524px; margin: 0 auto;
              var S3fTileProto = Object.create(HTMLElement.prototype);

S3fTileProto.spin = function() {
	// Initiate a spin when it is spinning does not look right.	
	if(this.isSpinning == true) return;
	this.isSpinning = true;

	var $element = $(this.shadowRoot).find("div");
	var $img = $(this.shadowRoot).find("img");
	var showFront = function() { $img.attr("src", this.attr("back-image")); }.bind($(this));
	var showBack = function() { $img.attr("src", "https://falicov.soluciones3f.com.ar/assets/texture.png"); };

	TweenLite.set($element, {transformPerspective:500});
	new TimelineLite()
		.fromTo($element, 1, {rotationY: "0deg"}, { rotationY: "90deg", ease: Power1.easeIn, onComplete: showFront })
		.to($element, 1, { rotationY: "180deg", ease: Power1.easeOut })
		.to($element, 1, { rotationY: "270deg", ease: Power1.easeIn, onComplete: showBack })
		.to($element, 1, { rotationY: "360deg", ease: Power1.easeOut, onComplete: function() { this.isSpinning = false }.bind(this) })

S3fTileProto.createdCallback = function() {
	this.addEventListener('click', this.spin);

	var clone = document.importNode($('#tile')[0].content, true);

document.registerElement("s3f-tile", { prototype: S3fTileProto });
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................