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 includes JSX processing.

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

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML

              
                <div class="wrap">
	<div class="top">
		<h1>ScrollMagic Demo</h1>
		<p>스크롤매직 라이브러리 데모입니다.<br/><a href="http://scrollmagic.io/examples/" target="_blank">여기</a>에서 더 많은 예시를 확인할 수 있습니다.</p>
	</div>
	<div class="main">
		<div class="spacer"></div>
		<div class="trigger" id="trigger1">Trigger 1</div>
		<div class="iconWrap">
			<div id="animate1" class="animation1">Hello, there!</div>
		</div>
		<div class="spacer"></div>
		<div class="trigger" id="trigger2">Trigger 2</div>
		<div class="ani2Wrap">
			<div class="animation2 box">one</div>
			<div class="animation2 box">two</div>
			<div class="animation2 box">three</div>
			<div class="animation2 box">four</div>
		</div>
		<div class="spacer"></div>
	</div>
	<div class="footer"><a href="https://nykim.work">nykim.work</a></div>
</div>
              
            
!

CSS

              
                * {
	margin: 0;
	padding: 0;
	font-family: monospace;
}

body {

	background-color: #f8f8f8;
}

.top {
	padding: 120px 50px;
	border-bottom: 1px solid #e0e0e0;
	background-color: #fff;
	
	h1 {
		font-size: 70px;
	}
	
	p {
		margin-top: 8px;
		font-size: 15px;
		line-height: 140%;
	}
}

.main {
	margin-top: 120px;
	padding: 0 50px;
	
	h2 {
		font-size: 30px;
		margin-bottom: 20px;
		letter-spacing: 2px;
	}
	
	.textWrap {
		padding-bottom: 30px;
		border-bottom: 1px solid #aaa;
	}
	
	.spacer {
		height: 350px;
	}
	
	.text {
		font-size: 14px;
		margin-bottom: 10px;
		line-height: 140%;
		
	}
	
	.iconWrap {
		display: flex;
		flex-wrap: wrap;
	}
	
	.icon {
		width: 140px;
		height: 140px;
		margin-right: 30px;
		color: #fff;
		font-size: 40px;
		line-height: 140px;
		text-align: center;
		background-color: #999;
		border-radius: 100%;
	}
}

.trigger {
	width: 100%;
	height: auto;
	font-weight: bold;
	font-size: 30px;
	color:#aaa;
	border-top:1px solid #aaa;
}

.footer {
	margin-top: 240px;
	padding: 0 50px;
	height: 40px;
	background-color: #222;
	
	a {
		display: block;
		line-height: 40px;
		font-family: monospace;
		letter-spacing: 1px;
		text-align: right;
		color: #fff;
	}
}

.animation1 {
	color: #fff;
	padding: 40px;
	font-size: 50px;
	background-color: crimson;
	box-shadow: 3px 14px 30px #ddd;
	transform: translateY(30px);
	opacity: 0;
	
	&.visible {
		opacity: 1;
		transform: translateY(0);
		transition: all 1.1s;
	}
}

.animation2 {
	&.box {
		transform: translateX(-30px);
		opacity: 0;
		display: block;
		width: 100px;
		height: 100px;
		background: #cff09e;
		text-align: center;
		font-size: 30px;
		line-height: 100px;
		margin-bottom: 20px;
		box-shadow: 3px 14px 30px #ddd;
		transition: all 0.5s;
		
		&:nth-child(2) {
			margin-left: 80px;
			background: #a8dba8;
		}
		&:nth-child(3) {
			margin-left: 160px;
			background: #79bd9a;
		}
		&:nth-child(4) {
			margin-left: 240px;
			margin-bottom: 0;
			background: #3b8686;
		}
	}
	&.visible {
		opacity: 1;
		transform: translateX(0);
		transition: all 0.5s;
	}
}
              
            
!

JS

              
                (function () {

  var controller = new ScrollMagic.Controller();
  var scene1 = new ScrollMagic.Scene({
      triggerElement: "#trigger1", //트리거 설정
			triggerHook: 0.8
    })
    .setClassToggle("#animate1", "visible")
    .addTo(controller)
    .addIndicators();
	
	var revealElements = document.getElementsByClassName("animation2");
	for (var i=0; i<revealElements.length; i++) {
		
		var scene2 = new ScrollMagic.Scene({
			triggerElement: revealElements[i],
			offset: 50,
			triggerHook: 0.9
		})
		.setClassToggle(revealElements[i], "visible") // add class toggle
		.addTo(controller)
		.addIndicators({name: "(box) " + (i+1), colorStart:"#F6B352", colorTrigger:"#F6B352"});
	}
	

}())
              
            
!
999px

Console