Skip to content

Commit

Permalink
🎩 fullscreen demos
Browse files Browse the repository at this point in the history
  • Loading branch information
desandro committed May 20, 2019
1 parent 8e0e4bb commit c020d9b
Show file tree
Hide file tree
Showing 24 changed files with 160 additions and 246 deletions.
24 changes: 9 additions & 15 deletions demos/box-cross/box-cross.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
// -------------------------- demo -------------------------- //
// ----- setup ----- //

var illoElem = document.querySelector('.illo');
var w = 9;
var h = 9;
var minWindowSize = Math.min( window.innerWidth - 20 , window.innerHeight - 20 );
var zoom = Math.floor( minWindowSize / w );
illoElem.setAttribute( 'width', w * zoom );
illoElem.setAttribute( 'height', h * zoom );
var sceneSize = 9;
var isSpinning = true;
var TAU = Zdog.TAU;
// colors
// var white = 'white';
var yellow = '#ED0';
var gold = '#EA0';
var orange = '#E62';
var garnet = '#C25';
// var navy = '#369';
// var denim = '#345';
var eggplant = '#636';

var initRotate = { x: (35/360) * TAU, y: TAU/8 };

var illo = new Zdog.Illustration({
element: illoElem,
zoom: zoom,
element: '.illo',
rotate: initRotate,
resize: 'fullscreen',
dragRotate: true,
onDragStart: function() {
isSpinning = false;
},
onResize: function( width, height ) {
this.zoom = Math.floor( Math.min( width, height ) / sceneSize );
},
});

// -- illustration shapes --- //
// ----- model ----- //

var model = new Zdog.Anchor({
addTo: illo,
Expand Down Expand Up @@ -111,7 +105,7 @@ dot.copy({
color: eggplant,
});

// -- animate --- //
// ----- animate ----- //

var ticker = 0;
var cycleCount = 150;
Expand Down
13 changes: 4 additions & 9 deletions demos/box-cross/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
body {
min-height: 100%;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
font-family: sans-serif;
text-align: center;
}

.illo {
display: block;
margin: 0px auto;
width: 100%;
height: 100%;
background: #FDB;
cursor: move;
}
Expand All @@ -30,9 +26,8 @@
</head>
<body>

<div class="container">
<canvas class="illo"></canvas>
</div>

<canvas class="illo"></canvas>

<script src="../../js/boilerplate.js"></script>
<script src="../../js/canvas-renderer.js"></script>
Expand Down
16 changes: 6 additions & 10 deletions demos/dot-cube/dot-cube.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
// ------------------------- demo ------------------------- //
// ----- setup ----- //

var illoElem = document.querySelector('.illo');
var sceneSize = 24;
var minWindowSize = Math.min( window.innerWidth - 20 , window.innerHeight - 20 );
var zoom = Math.floor( minWindowSize / sceneSize );
var illoSize = sceneSize * zoom;
illoElem.setAttribute( 'width', illoSize );
illoElem.setAttribute( 'height', illoSize );
var TAU = Zdog.TAU;

var illo = new Zdog.Illustration({
element: illoElem,
zoom: zoom,
element: '.illo',
rotate: { x: TAU * -35/360, y: TAU * 1/8 },
dragRotate: true,
resize: 'fullscreen',
onResize: function( width, height ) {
this.zoom = Math.floor( Math.min( width, height ) / sceneSize );
},
});

// ----- model ----- //
Expand All @@ -35,7 +32,6 @@ var dot = new Zdog.Shape({
translate: oneUnit.copy(),
stroke: 1,
color: 'white',
// visible: false,
});

dot.copy({ translate: { x: -1, y: 1 } });
Expand Down
12 changes: 3 additions & 9 deletions demos/dot-cube/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,22 @@
body {
min-height: 100%;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
background: black;
color: white;
font-family: sans-serif;
text-align: center;
}

.illo {
display: block;
margin: 0px auto 20px;
width: 100%;
height: 100%;
cursor: move;
}
</style>

</head>
<body>

<div class="container">
<canvas class="illo"></canvas>
</div>
<canvas class="illo"></canvas>

<script src="../../js/boilerplate.js"></script>
<script src="../../js/canvas-renderer.js"></script>
Expand Down
5 changes: 2 additions & 3 deletions demos/fullscreen/fullscreen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// ------------------------- demo ------------------------- //
// ----- setup ----- //

var zoom = 4;
var isSpinning = true;
var gold = '#EA0';
var orange = '#E62';
Expand All @@ -9,7 +8,7 @@ var eggplant = '#636';

var illo = new Zdog.Illustration({
element: '.illo',
zoom: zoom,
zoom: 4,
resize: 'fullscreen',
dragRotate: true,
onDragStart: function() {
Expand Down
4 changes: 2 additions & 2 deletions demos/fullscreen/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
width: 100%;
height: 100%;
cursor: move;
background: #FED;
background: #FDB;
}
</style>

</head>
<body>

<canvas class="illo" width="300" height="200"></canvas>
<canvas class="illo"></canvas>

<script src="../../js/boilerplate.js"></script>
<script src="../../js/canvas-renderer.js"></script>
Expand Down
18 changes: 7 additions & 11 deletions demos/hemisphere-cone-ball/hemisphere-cone-ball.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
// -------------------------- demo -------------------------- //

var illoElem = document.querySelector('.illo');
var w = 48;
var h = 48;
var minWindowSize = Math.min( window.innerWidth, window.innerHeight );
var zoom = Math.floor( minWindowSize / w );
illoElem.setAttribute( 'width', w * zoom );
illoElem.setAttribute( 'height', h * zoom );
// ----- setup ----- //

var sceneSize = 48;
var isSpinning = true;
var TAU = Zdog.TAU;

var illo = new Zdog.Illustration({
element: illoElem,
zoom: zoom,
element: '.illo',
dragRotate: true,
resize: 'fullscreen',
onDragStart: function() {
isSpinning = false;
},
onResize: function( width, height ) {
this.zoom = Math.floor( Math.min( width, height ) / sceneSize );
},
});

// colors
Expand Down
14 changes: 4 additions & 10 deletions demos/hemisphere-cone-ball/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,21 @@
body {
min-height: 100%;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
font-family: sans-serif;
text-align: center;
}

.illo {
background: #FDB;
display: block;
margin: 0px auto;
width: 100%;
height: 100%;
background: #FDB;
cursor: move;
}
</style>

</head>
<body>

<div class="container">
<canvas class="illo"></canvas>
</div>
<canvas class="illo"></canvas>

<script src="../../js/boilerplate.js"></script>
<script src="../../js/canvas-renderer.js"></script>
Expand Down
15 changes: 6 additions & 9 deletions demos/houses/houses.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// ------------------------- demo ------------------------- //
// ----- setup ----- //

var illoElem = document.querySelector('.illo');
var sceneSize = 56;
var minWindowSize = Math.min( window.innerWidth - 20 , window.innerHeight - 20 );
var zoom = Math.floor( minWindowSize / sceneSize );
var illoSize = sceneSize * zoom;
illoElem.setAttribute( 'width', illoSize );
illoElem.setAttribute( 'height', illoSize );
var isSpinning = true;
var TAU = Zdog.TAU;

Expand All @@ -27,15 +21,18 @@ var initRotate = { y: TAU/8 };
var turnRatio = 1 / Math.sin( TAU/8 );

var illo = new Zdog.Illustration({
element: illoElem,
zoom: zoom,
element: '.illo',
rotate: initRotate,
// stretch looks circular at 1/8 turn
scale: { x: turnRatio, z: turnRatio },
dragRotate: true,
resize: 'fullscreen',
onDragStart: function() {
isSpinning = false;
},
onResize: function( width, height ) {
this.zoom = Math.floor( Math.min( width, height ) / sceneSize );
},
});

// ----- model ----- //
Expand Down
3 changes: 2 additions & 1 deletion demos/houses/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

.illo {
display: block;
margin: 0px auto;
width: 100%;
height: 100%;
background: #FDB;
cursor: move;
}
Expand Down
12 changes: 3 additions & 9 deletions demos/kirby-parasol/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,22 @@
body {
min-height: 100%;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
background: #425;
color: white;
font-family: sans-serif;
text-align: center;
}

.illo {
display: block;
margin: 0px auto 20px;
width: 100%;
height: 100%;
cursor: move;
}
</style>

</head>
<body>

<div class="container">
<canvas class="illo"></canvas>
</div>
<canvas class="illo"></canvas>

<script src="../../js/boilerplate.js"></script>
<script src="../../js/canvas-renderer.js"></script>
Expand Down
40 changes: 17 additions & 23 deletions demos/kirby-parasol/kirby-parasol.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
// -------------------------- demo -------------------------- //

var illoElem = document.querySelector('.illo');
var w = 80;
var h = 80;
var minWindowSize = Math.min( window.innerWidth, window.innerHeight );
var zoom = Math.min( 7, Math.floor( minWindowSize / w ) );
illoElem.setAttribute( 'width', w * zoom );
illoElem.setAttribute( 'height', h * zoom );
// ----- setup ----- //

var sceneSize = 80;
var isSpinning = true;
var TAU = Zdog.TAU;

var illo = new Zdog.Illustration({
element: illoElem,
zoom: zoom,
dragRotate: true,
onDragStart: function() {
isSpinning = false;
},
});

// colors
var pink = '#F8B';
var blush = '#F5A';
Expand All @@ -28,7 +11,19 @@ var shoe = '#D03';
var red = '#E10';
var yellow = '#FD0';

// -- illustration shapes --- //
var illo = new Zdog.Illustration({
element: '.illo',
dragRotate: true,
resize: 'fullscreen',
onDragStart: function() {
isSpinning = false;
},
onResize: function( width, height ) {
this.zoom = Math.floor( Math.min( width, height ) / sceneSize );
},
});

// ----- model ----- //

var body = new Zdog.Shape({
stroke: 22,
Expand Down Expand Up @@ -263,8 +258,7 @@ new Zdog.Shape({
}
})();

// ----- floater stars ----- //

// floater stars
( function() {
for ( var i=0; i < 6; i++ ) {
var starHolder = new Zdog.Anchor({
Expand All @@ -279,7 +273,7 @@ new Zdog.Shape({
}
})();

// -- animate --- //
// ----- animate ----- //

function animate() {
illo.rotate.y += isSpinning ? -0.03 : 0;
Expand Down
Loading

0 comments on commit c020d9b

Please sign in to comment.