Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <body>
  <trigger id="trigger_beach"/>
  <div id="scene_beach">
	<div class="water"></div>
	<div class="sky"></div>
	<div class="beach">
    <!-- the normal palm leans right-->
		<div class="palm1">unflipped</div>
     <!-- the flipped palm leans left-->
    <div class="palm2 flip intended">SIHT TNAW</div>
     <!-- the none of this works: css transform -->
		<div class="palm2 flip scale">transform+scale</div>
		<div class="palm2 flip usingset">set</div>
    <!-- the none of this works: matrix transform -->
		<div class="palm2 flipm scale">matrix+scale</div>
		<div class="palm2 flipm usingset">set</div>
		<div class="palm2 noflip usingset right">no-css + set</div>
		<div class="beach1"></div>
		<div class="beach2"></div>
	</div>
  </div>
	<div class=""></div>

</body>
              
            
!

CSS

              
                body{
	padding: 0;
	margin: 0;
	height: 180vh;
	background: #7dffd7;
	background: aqua;
}
div [id^=scene_]{
	width: 100%;
	height: 100%;
}
div [id^=scene_] > div{
	position: absolute;
}

.beach {
    width: 100%;
	
}
.beach1 {
    width: 100%;
    height: 20vh;
    background: linear-gradient(#F1EEDF,#F3E7C6);
    border-radius: 70% 50% 0 0;
	box-sizing: border-box;
	box-shadow: 0 0 15px 16px aqua;
}
.beach2 {
    width: 100%;
    height: 80vh;
    background: linear-gradient(#F3E7C6,#D2B279);
}
.water {
    width: 100%;
    height: 95vh;
    background: linear-gradient(royalblue 55%,aqua);
}
.sky {
    width: 100%;
    height: 60vh;
    background: linear-gradient(royalblue,skyblue);
	border-bottom: 1px solid #4dbdec;
}
.palm1,
.palm2 {
    width: 10vw;
    height: 63vh;
    background: url("https://media.istockphoto.com/photos/green-palm-tree-leaf-with-isolated-on-white-clipping-path-picture-id157439518") 100% 100%/contain no-repeat;
    position: absolute;
    top: -50vh;
  border: 1px solid
}

.flip {
	transform: scaleX(-1);
}
.flipm {
	transform: matrix(-1, 0, 0, 1, 0, 0);
}
.right {
	right: 0;
}

.intended{
  left: 15vw;
}
.flip.scale{
  left: 30vw;
}
.flip.usingset{
  left:45vw;
}
.flipm.scale{
  left: 60vw;
}
.flipm.usingset{
  left:75vw;
}
              
            
!

JS

              
                //$(function () { // wait for document ready
			// init
			var controller = new ScrollMagic.Controller();
			// create scene to pin and link animation
			new ScrollMagic.Scene({
					triggerElement: "#trigger_beach",
					triggerHook: "onLeave",
					duration: "100%"
				})
				.setPin("#scene_beach")
				.setTween(new TimelineMax()// define movement of panels
					.fromTo("div.beach",	1, {y:"0%"}, {y: "80%", ease: Linear.easeNone}) // comes down
					.fromTo("div.water",	3, {y:"-100%"}, {y: "0%", ease: Linear.easeNone}) // in from top
					.fromTo("div.sky",		5, {y:"-100%"}, {y: "0%", ease: Linear.easeNone}) // in from top
					.add([
        //intended behaviour
						TweenMax.from("div.palm2.intended",	1, {y:"2%",x:"30%",height:"60vh",width:"12vw", ease: Linear.easeNone}),
        //using scale
            TweenMax.from("div.palm2.scale",	1, {y:"2%",x:"30%",scale:"0.5", ease: Linear.easeNone}),
        //suggested fix by GSAP admin using set(scale)
						TweenMax.set("div.palm2.flip.usingset", {scaleX:-1}),
						TweenMax.from("div.palm2.flip.usingset",	1, {y:"-2%",x:"-30%",scale:"0.5", ease: Linear.easeNone}),
        //suggested fix by GSAP admin using set(matrix)
						TweenMax.set("div.palm2.flipm.usingset", {matrix:"-1, 0, 0, 1, 0, 0"}),
						TweenMax.from("div.palm2.flipm.usingset",	1, {y:"-2%",x:"-30%",scale:"0.5", ease: Linear.easeNone}),
        //not using css to flip at all & using set(scale)
            TweenMax.set("div.palm2.noflip.usingset", {scaleX:-1}),
            TweenMax.from("div.palm2.noflip.usingset",	1, {y:"-2%",x:"-30%",scale:"0.5", ease: Linear.easeNone}),
					])
					.fromTo("div.beach1",	1, {borderTop: "0px solid white"}, {borderTop: "20px solid white", ease: Linear.easeNone}) // waves
					.fromTo("div.sun",		1, {y: "-110%",x: "110%"}, {y: "0%",x:"0%", ease: Linear.easeNone})
        )
.addTo(controller);
//});
              
            
!
999px

Console