Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 or require. We'll also process your JavaScript with Babel.

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

Behavior

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <template id="engine-item-self">
	<div class="engine-item" :style="{ transform: `translate(-50%, -50%) rotate(${angle}deg)` }">
		<div class="engine-item__head">
			<div class="engine-item__in-pipe engine-item__in-pipe--f"></div>
			<div class="engine-item__spark-plug">
				<span class="engine-item__spark-plug-fire" :style="{animationDelay: `${delay}s`, animationDuration: `${speed}s`}"></span>
			</div>
			<div class="engine-item__gate engine-item__gate--in" :style="{animationDelay: `${delay+0.3}s`, animationDuration: `${speed}s`}"></div>
			<div class="engine-item__gate engine-item__gate--out" :style="{animationDelay: `${delay}s`, animationDuration: `${speed}s`}"></div>
			<div class="engine-item__fire" :style="{animationDelay: `${ delay }s`, animationDuration: `${speed}s`}"></div>
			<div class="engine-item__piston" :style="{animationDelay: `${ delay }s`, animationDuration: `${speed}s`}"></div>
			<div class="engine-item__rod" :style="{animationDelay: `${ delay }s`, animationDuration: `${speed}s`}"></div>
		</div>
	</div>
</template>
<div id="application">
	<div class="application">
		<div class="application__controlls" :style="{ backgroundColor: `rgba(231,29,54,${getOpacity})` }">
			<label class="label label--speed">
				<input class="speed" type="range" min="0.1" max="1.5" step="0.1" @input="getSpeed"/>
				<span>speed</span>
			</label>
			<label class="label label--amount">
				<input class="amount" type="range" min="1" max="8" step="1" @input="changeAmount"/>
				<span>amount</span>
			</label>
		</div>
		<div class="board">
			<engine-item v-for="(item, index) in amount" :angle='index * getAngle' :delay='index * ( speed / amount * 2 )' :speed="speed"></engine-item>
			<div class="engine-item__body"></div>
			<div class="engine-crank" :style="{animationDuration: `${speed}s`}"></div>
		</div>
	</div>
</div>
            
          
!
            
              $size: 60px
$e_color: #3A405A//#005555
$g_color: #222222
$a_color: #3A405A//lightblue
$blink_color: #FF8419
$f_color: #E71D36//red
$empty_color: #1B998B
$time: 0.4s
$easing: ease
$lgh: 1.7
@import url('https://fonts.googleapis.com/css?family=Poppins')
$font: 'Poppins', sans-serif
html,body
	margin: 0
	padding: 0
	width: 100%
	height: 100%
	box-sizing: border-box
	font-family: $font
*,*:before,*:after
	box-sizing: inherit
input[type="range"] 
	-webkit-appearance: none
	background-color: $empty_color
	width: 120px
	height: 1px
	outline: none
input[type="range"]::-webkit-slider-thumb 
	-webkit-appearance: none
	background-color: $f_color
	border: 1px solid $f_color
	width: 30px
	height: 15px
	border-radius: 5px
.application
	position: absolute
	top: 50%
	left: 50%
	transform: translate(-50%, -50%)
	&__controlls
		position: absolute
		z-index: 1000
		border: 1px solid rgba($f_color, 0.2)
		border-radius: 10px
		background-color: rgba($f_color, 0.1)
		padding: $size / 10
		top: -$size * 1.5
		left: 49%
		transform: translateX(-50%)
		box-shadow: 1px 1px 15px rgba($f_color, 0.7)
.label span
	display: block
	padding: 0
	line-height: 20px
	font-size: 12px
	color: $e_color
.board
	width: $size * 7
	height: $size * 7
	position: relative
.engine-crank
	position: absolute
	width: $size * 1.4
	height: $size * 1.4
	background-color: $e_color
	border-radius: 50% 50% 52% 48% / 72% 72% 28% 28%
	position: absolute
	top: 50%
	left: 50%
	transform: translate(-50%, -50%)
	transform-origin: 0% 0%
	animation: crank_go $time linear infinite
	&:before
		content: ''
		position: absolute
		width: 100%
		height: $size / 40
		background-color: $e_color*1.2
		top: 50%
		transform: translateY(-50%)
.engine-item
	position: absolute
	height: $size * 2.5
	//border: 1px solid $e_color
	top: 32%
	left: 50%
	transform-origin: 50% 100%
	&__body
		position: absolute
		width: $size*2.4
		height: $size*2.4
		border: 3px solid rgba($empty_color, 0.2)
		background-color: rgba($empty_color, 0.1)
		border-radius: 50%
		top: 50%
		left: 50%
		transform: translate(-50%, -50%)
		z-index: -1
	&__head
		width: $size
		height: $size * 1.4
		border: $size / 15 solid $e_color
		border-bottom: none
		position: relative
		background-color: rgba($empty_color, 0.1)
	&__fire
		position: absolute
		top: 0
		left: 0
		width: 100%
		height: $size / 7
		background: $blink_color
		transform-origin: 50% 0
		animation: fire_go $time $easing infinite
	&__piston
		position: absolute
		width: 100%
		top: $size / 7
		height: $size / 2.2
		background-color: $e_color * 0.6
		transform-origin: 50% 0
		animation: piston_go $time $easing infinite
	&__spark-plug
		position: absolute
		height: $size / 3
		width: $size / 10
		left: calc(50% - #{$size / 10 / 2})
		top: -$size / 3.5
		background-color: $e_color * 1.2
	&__spark-plug-fire
		position: absolute
		width: $size / 8
		height: $size / 8
		border-radius: 50%
		bottom: -$size / 8
		transform-origin: center center
		left: calc(50% - #{$size / 8 / 2})
		animation: spark_plug_go $time $easing infinite
	&__gate
		position: absolute
		width: $size / 16
		height: $size / 3
		background-color: $g_color
		top: -$size / 3.5
		z-index: 3000
		animation: gate_go $time $easing infinite
		&:before
			content: ''
			position: absolute
			width: $size / 7
			height: $size / 16
			background-color: $g_color
			bottom: 0
			left: 50%
			transform: translateX(-50%)
	&__gate--in
		left: $size / 7
	&__gate--out
		right: $size / 7
	&__rod
		position: absolute
		height: $size * 1.91
		width: $size / 14
		background: $e_color * 0.6
		top: $size / 3
		left: calc(50% - #{$size / 30})
		transform-origin: 50% 0
		transition: 0.3s linear
		animation: rod_go $time linear infinite
		&:before
			content: ''
			position: absolute
			width: $size / 7
			height: 100%
			transform: rotate(3deg) translateX(-$size / 10)
			background: $e_color * 0.6
		&:after
			content: ''
			position: absolute
			width: $size / 7
			height: 100%
			transform: rotate(-3deg) translateX($size / 23)
			background: $e_color * 0.6
@keyframes piston_go
	0%,100%
		transform: translateY(0)
	50%
		transform: translateY($size / $lgh)
@keyframes crank_go
	0%
		transform: rotate(0deg) translate(-50%, -50%)
	100%
		transform: rotate(360deg) translate(-50%, -50%)
@keyframes rod_go
	0%,100%
		transform: rotate(0deg) translateY(0)
	25%
		transform: rotate(-10deg) translate(-$size / 14, $size/$lgh/2)
	50%
		transform: rotate(0deg) translate(0px, $size/$lgh)
	75%
		transform: rotate(10deg) translate($size / 14, $size/$lgh/2)
@keyframes fire_go
	0%,100%
		opacity: 0
		transform: scaleY(0)
	60%
		background-color: $f_color
	60%
		opacity: 1
		transform: scaleY(6.3)
	90%
		background-color: $a_color
@keyframes gate_go
	0%,49%,55%,100%
		transform: translateY(0)
	50%
		transform: translateY($size / ($lgh*6))
@keyframes spark_plug_go
	0%,100%
		opacity: 0
		transform: scale(0)
	20%
		background-color: $f_color
	20%
		opacity: 1
		transform: scale(1.3)
            
          
!
            
              Vue.component('engine-item', {
	template: '#engine-item-self',
	props: ['angle', 'delay', 'speed']
});
new Vue({
	el: '#application',
	data: {
		amount: 8,
		speed: .5
	},
	methods: {
		changeAmount (e) {
			this.amount = +e.target.value;
		},
		getSpeed (e) {
			this.speed = 1.6 - +e.target.value;
		}
	},
	computed: {
		getAngle () {
			return 360 / this.amount;
		},
		getOpacity () {
			return 0.5 - this.speed * 0.2;
		}
	}
});
            
          
!
999px

Console