Bedazzle Template
This is a template for experimenting with bedazzle.
by DamonOehlman
HTML
<script src="https://github.com/DamonOehlman/stylar/raw/master/stylar.js"></script>
<script src="https://github.com/DamonOehlman/ratchet/raw/master/ratchet.js"></script>
<script src="https://github.com/documentcloud/underscore/raw/master/underscore-min.js"></script>
<script src="https://github.com/DamonOehlman/bedazzle/raw/master/bedazzle.js"></script>
<section id="boxes">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</section>
<section class="about">
<h2>Bedazzle Template</h2>
<p>A base template for playing with bedazzle scripted animation.</p>
</section>
<a target="_blank" href="https://github.com/DamonOehlman/bedazzle"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://a248.e.akamai.net/assets.github.com/img/7afbc8b248c68eb468279e8c17986ad46549fb71/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub"></a>
CSS
.box {
background: red;
height: 50px;
width: 50px;
margin: 10px;
-webkit-transition: all ease-in-out 0.5s;
-moz-transition: all ease-in-out 0.5s;
-o-transition: all ease-in-out 0.5s;
-ms-transition: all ease-in-out 0.5s;
transition: all ease-in-out 0.5s;
}
body {
font-family: Helvetica;
margin-top: 20px;
}
section.about {
margin: 10px 0;
background: #333;
color: white;
padding: 10px;
position: fixed;
bottom: 0px;
width: 100%;
}
h2 {
font-size: 1.1em;
font-weight: bold;
margin-bottom: 5px;
}
#boxes {
margin: 10px;
-webkit-perspective: 500px
-moz-perspective: 500px;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
}
JavaScript
bedazzle('.box')
.frame.x(100)
.frame.y(50).set('background', 'navy')
.frame.x(-100).y(-50)
.frame.rotate(150).end(function(elements) {
stylar(elements)
.set('border-radius', '25px')
.set('background', 'red');
});