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

              
                		<div class="conrner-nav"> <!-- START CORNER-NAV -->
			<div id="print" class="media-type">
				<a href="#">
					<span id="title-print" class="title-print"><h2>print</h2></span>
				</a>
				
				<img src="https://dummyimage.com/700x500/ffffff/ebebeb.gif" alt="Print Portfolio Samples">
			</div>

<!-- 			<div id="broadcast" class="media-type">
				<a href="#">
					<span id="title-broadcast"><h2>broadcast</h2></span>
				</a>
				
				<img src="https://dummyimage.com/700x500/ffffff/ebebeb.gif" alt="Broadcast Portfolio Samples">
			</div>

			<div id="outdoor" class="media-type">
				<a href="#">
					<span id="title-outdoor"><h2>outdoor</h2></span>
				</a>
			
				<img src="https://dummyimage.com/700x500/ffffff/ebebeb.gif" alt="Outdoor Portfolio Samples">
			</div>

			<div id="online" class="media-type">
				<a href="#">
					<span id="title-online"><h2>online</h2></span>
				</a>

				<img src="https://dummyimage.com/700x500/ffffff/ebebeb.gif" alt="Online Portfolio Samples">
			</div> -->
		</div> <!-- END CORNER-NAV -->
	</div> <!-- END MAIN-STAGE -->
              
            
!

CSS

              
                /* *********************** */
/* ***** Main Styles ***** */
/* *********************** */

body {
  overflow: hidden;
  margin: 0;
  padding: 0;
}

#print {
  visibility: hidden;
}


/* warm gray */
body {
  background-color: #afafaf; }
 

/* div {
  border: 1px solid red; }

span {
  border: 1px solid green; } */



/* ********************************* */
/* ***** Section - ID - Styles ***** */
/* ********************************* */
#main-stage {
  width: 100vw;
  height: 100vh; }

.conrner-nav {
  width: 100vw;
  height: 100vh; }


.media-type {
    position: fixed;
    display: inline-block;
    width: 50vw;
    max-height: 50vh;
    max-width: 50vh; }

.media-type img {
    position: relative;
    display: inline-block;
    width: 50vw;
    max-height: 50vh;
    max-width: 50vh; }


@media all and (max-height: 400px) {
.media-type h2 {
    font-size: 16px; }}

@media all and (max-width: 400px) {
.media-type h2 {
    font-size: 16px; }}

@media all and (min-width: 1000px) and (min-height: 301px) {
.media-type,
.media-type img {
    width: 35vw;
    max-height: 35vh;
    max-width: 35vh; }}

@media all and (max-height: 300px) {
.media-type,
.media-type img {
    width: 60vw;
    max-height: 60vh;
    max-width: 60vh; }}

@media all and (min-width: 501px) and (max-width: 999px) and (min-height: 301px) {
.media-type,
.media-type img {
    width: 40vw;
    max-height: 40vh;
    max-width: 40vh; }}

#print {
    top: -8vh;
    left: -8vh;
    transform: rotate(8deg);
    z-index: 2; }

#broadcast {
    top: -8vh;
    right: -8vh;
    transform: rotate(-8deg);
    z-index: 2; }

#outdoor {
    bottom: -8vh;;
    left: -8vh;
    transform: rotate(-18deg);
    z-index: 2; }

#online {
    bottom: -8vh;
    right: -8vh;
    transform: rotate(10deg);
    z-index: 2; }


/* ********************************* */
#title-print {
    position: absolute;
    bottom: 0;
    right: 0;
    padding-bottom: 4vh;
    padding-right: 6vh;    
    z-index: 4; }


/* ********************************* */
#title-broadcast {
    position: absolute;
    left: 0;
    bottom: 0;
    padding-bottom: 4vh;
    padding-left: 6vh;
    z-index: 4; }


/* ********************************* */
#title-outdoor {
    position: absolute;
    top: 0;
    right: 0;
    padding-top: 4vh;*
    padding-right: 6vh;
    z-index: 4; }


/* ********************************* */
#title-online {
    position: absolute;
    top: 0;
    left: 0;
    padding-top: 4vh;
    padding-left: 6vh;    
    z-index: 4; }

              
            
!

JS

              
                
var vw = $(window).width();
var vh = $(window).height();

var print = $("#print");

var x = -vw / 2;
var y = -vh / 2;

var values = [
  { x: x, y: y },
  { x: x, y: 0 },
  { x: 0, y: 0 }
];

var bezier = {
  values: values,
  type: "quadratic"
};

TweenLite.set(print, { 
  autoAlpha: 1, 
  rotation: 8, 
  xPercent: -50,
  yPercent: -50,
  left: "50%",
  top: "50%",
  x: x, 
  y: y 
});

var tl = new TimelineMax()
  .to(print, 1, { bezier: bezier, scale: 3, rotation: 0 })
  .reverse();

print.click(function() {
  tl.reversed(!tl.reversed());
});

// Custom Javascript


/* ******* GreenSock GSAP Animation ******* */

// Variable to calculate browser window height and width
// var winWidth = window.innerWidth
// || document.documentElement.clientWidth
// || document.body.clientWidth;

// var winHeight = window.innerHeight
// || document.documentElement.clientHeight
// || document.body.clientHeight;


// var
//     $print = $('#print'),
//     $broadcast = $('#broadcast'),
//     $outdoor = $('#outdoor'),
//     $online = $('#online'),
//     $titlePrint = $('#title-print'),
//     $titleBroadcast = $('#title-broadcast'),
//     $titleOutdoor = $('#title-outdoor'),
//     $titleOnline = $('#title-online'),

//     // Paths for Print
//     path01Print     = [{x:winWidth*.125, y:winHeight*.3}, {x:winWidth*.5, y:winHeight*.5}],
//     path02Broadcast = [{x:winWidth*1.3, y:winHeight*.3}, {x:winWidth*1.5, y:winHeight*.5}],
//     path03Outdoor   = [{x:winWidth*1.3, y:winHeight*1.3}, {x:winWidth*1.5, y:winHeight*.5}],
//     path04Online    = [{x:winWidth*1.3, y:winHeight*1.3}, {x:winWidth*1.5, y:winHeight*1.5}],

//     // Paths for Broadcast
//     path05Print     = [{x:winWidth* -.3, y:winHeight* -.3}, {x:winWidth* -.5, y:winHeight* -.5}],
//     path06Broadcast = [{x:winWidth* -.125, y:winHeight*.3}, {x:winWidth* -.5, y:winHeight*.5}],
//     path07Outdoor   = [{x:winWidth* -.125, y:winHeight*1.3}, {x:winWidth* -.5, y:winHeight*1.5}],
//     path08Online    = [{x:winWidth* -.125, y:winHeight*1.3}, {x:winWidth* -.5, y:winHeight*1.5}],

//     // Paths for Outdoor
//     path09Print     = [{x:winWidth*.125, y:winHeight* -.3}, {x:winWidth*.5, y:winHeight* -.5}],
//     path10Broadcast = [{x:winWidth*1.3, y:winHeight* -.3}, {x:winWidth* -.5, y:winHeight*-1.5}],
//     path11Outdoor   = [{x:winWidth*.125, y:winHeight* -.125}, {x:winWidth* .5, y:winHeight* -.5}],
//     path12Online    = [{x:winWidth*1.3, y:winHeight* -.125}, {x:winWidth*1.5, y:winHeight* -.5}],

//     // Paths for Online
//     path13Print     = [{x:winWidth* -.3, y:winHeight* -.3}, {x:winWidth* -.3, y:winHeight* -.3}],
//     path14Broadcast = [{x:winWidth* -.3, y:winHeight* -.3}, {x:winWidth* -.3, y:winHeight* -.3}],
//     path15Outdoor   = [{x:winWidth* -.3, y:winHeight* .3}, {x:winWidth* -.3, y:winHeight* -.3}],
//     path16Online    = [{x:winWidth* -.3, y:winHeight* -.3}, {x:winWidth* -.5, y:winHeight* -.5}],

//     // Timeline Names
//     tlPrint     = new TimelineMax({repeat: 0, yoyo: false, paused: true});
//     tlBroadcast = new TimelineMax({repeat: 0, yoyo: false, paused: true});
//     tlOutdoor   = new TimelineMax({repeat: 0, yoyo: false, paused: true});
//     tlOnline    = new TimelineMax({repeat: 0, yoyo: false, paused: true});

// // Timeline Actions
// tlPrint.to($print,                1, {bezier:{curviness: 0.3, values:path01Print},         scale: 3, rotation: 0, top: "0vh", left: "0vh", ease:Power1.easeInOut}, 0)
//         // Note I have CSS that moves the corner images off the browser edge based on "vh" percentage
//         // If I delacare the "vh" in the timeline it moves it but it's still not centered

//        //.to($print,                1, { transformOrigin: "center center", x: getMidX("#print"), y: getMidY("#print") }, 0)
//        .to($titlePrint,         .25, { opacity:0, display:"none" }, 0)
//        .to($broadcast,            1, {bezier:{curviness: 0.3, values:path02Broadcast},     scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
//        .to($outdoor,              1, {bezier:{curviness: 0.3, values:path03Outdoor},       scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
//        .to($online,               1, {bezier:{curviness: 0.3, values:path04Online},        scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)

// tlBroadcast.to($print,            1, {bezier:{curviness: 0.3, values:path05Print},         scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
//            .to($broadcast,        1, {bezier:{curviness: 0.3, values:path06Broadcast},     scale: 3, rotation: 0, top: "0vh", right: "0vh", ease:Power1.easeInOut}, 0)
//            //.to($broadcast,        1, { transformOrigin: "center center", x: getMidX("#broadcast"), y: getMidY("#broadcast") }, 0)
//            .to($titleBroadcast, .25, { opacity:0, display:"none" }, 0)
//            .to($outdoor,          1, {bezier:{curviness: 0.3, values:path07Outdoor},       scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
//            .to($online,           1, {bezier:{curviness: 0.3, values:path08Online},        scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)

// tlOutdoor.to($print,              1, {bezier:{curviness:   0.3, values:path09Print},       scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
//          .to($broadcast,          1, {bezier:{curviness:   0.3, values:path10Broadcast},   scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
//          .to($outdoor,            1, {bezier:{curviness:   0.3, values:path11Outdoor},     scale: 2, rotation: 0, bottom: "0vh", left: "0vh", ease:Power1.easeInOut}, 0)
//          //.to($outdoor,              1, { transformOrigin: "center center", x: getMidX("#outdoor"), y: getMidY("#outdoor") }, 0)
//          .to($titleOutdoor,     .25, { opacity:0, display:"none" }, 0)
//          .to($online,             1, {bezier:{curviness:   0.3, values:path12Online},      scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)

// tlOnline.to($print,               1, {bezier:{curviness:   0.3, values:path13Print},       scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
//         .to($broadcast,           1, {bezier:{curviness:   0.3, values:path14Broadcast},   scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
//         .to($outdoor,             1, {bezier:{curviness:   0.3, values:path15Outdoor},     scale: 1, rotation: 0, ease:Power1.easeInOut}, 0)
//         .to($online,              1, {bezier:{curviness:   0.3, values:path16Online},      scale: 3, rotation: 0, bottom: "0vh", right: "0vh", ease:Power1.easeInOut}, 0)
//         //.to($online,              1, { transformOrigin: "center center", x: getMidX("#online"), y: getMidY("#online") }, 0)
//         .to($titleOnline,       .25, { opacity:0, display:"none" }, 0)


// // Play onClick
//   $("#print").click(function() {
//         tlPrint.play(); });

//   $("#broadcast").click(function() {
//         tlBroadcast.play(); });

//   $("#outdoor").click(function() {
//         tlOutdoor.play(); });

//   $("#online").click(function() {
//         tlOnline.play(); });


// Timeline Function to Center Objects - this moves it in the other direction but still not centered
// Greensock forum https://greensock.com/forums/topic/13542-positioning-relative-to-center/
// Greensock CodePen https://codepen.io/sgorneau/pen/bErqdm

// tl.to(".target", 1, { x: getMidX(".target")+20, y: getMidY(".target") } ); // This line of code had been placed in timelines above and commented out

/* function getMidX( obj ){
  return ( $(obj).parent().width()/2 ) - $(obj).width()/2;
}

function getMidY( obj ){
  return ( $(obj).parent().height()/2 ) - $(obj).height()/2;
} */


// I also looked at https://greensock.com/forums/topic/13802-update-height-value-dinamically-on-window-resize/
// CodePen https://codepen.io/celli/pen/XdWaRv - looking at for image size and the on window resize function




              
            
!
999px

Console