A Pen by Richard Moot on CodePen.
Created
July 29, 2014 03:25
-
-
Save mootrichard/2977b295e978c48d5af3 to your computer and use it in GitHub Desktop.
A Pen by Richard Moot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="test"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomNum(num, bottom){ | |
return Math.floor((Math.random() * num) + bottom); | |
} | |
function randomColor(){ | |
var a = randomNum(255, 0), | |
b = randomNum(255, 0), | |
c = randomNum(255, 0); | |
$(this).css('background', 'rgb('+a+','+b+','+c+')'); | |
} | |
function randomScale(){ | |
var a = randomNum(5, 1); | |
$(this).css('transform', 'scale('+a+')'); | |
} | |
$('.test').on('click', randomColor); | |
$('.test').on('click', randomScale); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.test { | |
width:200px; | |
height:200px; | |
background:orange; | |
border-radius:50%; | |
margin:auto; | |
transition:all 500ms ease .15s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment