Birthday confetti heart love
svg mask and filter canvas animated bg css animation bouns Jade Stylus Coffee
.container
.container
canvas#world
.img
svg(viewbox='0 0 500 400').animated.zoomIn
defs
filter#feDisplacementMap(filterunits='userSpaceOnUse', x='0', y='0', width='500', height='400')
feturbulence(type='fractalNoise', basefrequency='0.995', numoctaves='1', seed='1', stitchtiles='noStitch', result='img')
fedisplacementmap(in='SourceGraphic', in2='img', xchannelselector='R', ychannelselector='G', scale='0')
animate(attributename='scale', values='50;0;0', keytimes='0;0.75;1', begin='0s', dur='5s')
symbol#s-text
text.text(text-anchor='middle', x='50%', y='50%', dy='.35em') ♥
mask#m-text(maskunits='userSpaceOnUse', maskcontentunits='userSpaceOnUse')
use#textMask(xlink:href='#s-text')
g#mainImg(mask='url(#m-text)',filter="url(#feDisplacementMap)")
image(xlink:href='http://cs625624.vk.me/v625624893/2e626/2JbQNf0TmZg.jpg', width='100%', height='100%', x='10%', y='0%')
.num.animated.lightSpeedIn <span class='gold'>19</span> year)
.small С Днем Рождения <a href="http://vk.com/hey_good_morning" class='myNotMy'>Яночка</a>!!!
link(rel="stylesheet", href="//cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.6/animate.min.css")
@import url("http://fonts.googleapis.com/css?family=Lobster&subset=latin,cyrillic");
@import url("http://fonts.googleapis.com/css?family=Lobster&subset=latin,cyrillic");
*
box-sizing border-box
.flex
html
body
width 100%
height 100%
a
text-decoration none
body
bcl = #333
background bcl
background linear-gradient(45deg,bcl,darken(bcl,15),bcl)
margin 0
font-family: 'Lobster', cursive;
overflow hidden
#textMask
fill: white;
stroke: white;
stroke-opacity: .2;
stroke-width: 10;
font-size: 490px
.container
position relative
height 100%
width 100%
#world
.img
left 0
top 0
bottom 0
right 0
.num
.img
text-align center
position absolute
svg
height: 100%
width 100%
.num
left 0
bottom 0
right 0
color rgba(255, 255, 255, .99)
text-shadow 0px 0px 5px
font-size 150px
@media (max-width:870px)
font-size 100px
@media (max-width:588px)
font-size 50px
animation-delay: 1s
.small
font-size 50%
.gold
color rgba(245, 240, 22, .99)
.myNotMy
color rgba(69, 183, 207, .99)
.anim-love
transform translate3d(0,0,0)
animation lovelovelove 1s ease infinite alternate
@keyframes lovelovelove
to
font-size: 550px
@media screen and (min-device-pixel-ratio:0)
.anim-love
transform-origin 50% 50%
animation scalHeart 1s ease infinite alternate
@keyframes scalHeart
to
s = .88
transform scale3d(s,s,s)
setTimeout ()->
setTimeout ()->
mainImg.setAttribute('filter','')
textMask.classList.add("anim-love")
,5000
NUM_CONFETTI = 69
COLORS = [[85,71,106], [174,61,99], [219,56,83], [244,92,68], [248,182,70]]
PI_2 = 2*Math.PI
canvas = document.getElementById "world"
context = canvas.getContext "2d"
window.w = 0
window.h = 0
resizeWindow = ->
window.w = canvas.width = window.innerWidth
window.h = canvas.height = window.innerHeight
window.addEventListener 'resize', resizeWindow, false
window.onload = -> setTimeout resizeWindow, 0
range = (a,b) -> (b-a)*Math.random() + a
drawCircle = (x,y,r,style) ->
context.beginPath()
context.arc(x,y,r,0,PI_2,false)
context.fillStyle = style
context.fill()
xpos = 0.5
document.onmousemove = (e) ->
xpos = e.pageX/w
window.requestAnimationFrame = do ->
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
(callback) -> window.setTimeout(callback, 1000 / 60)
class Confetti
constructor: ->
@style = COLORS[~~range(0,5)]
@rgb = "rgba(#{@style[0]},#{@style[1]},#{@style[2]}"
@r = ~~range(2,6)
@r2 = 2*@r
@replace()
replace: ->
@opacity = 0
@dop = 0.03*range(1,4)
@x = range(-@r2,w-@r2)
@y = range(-20,h-@r2)
@xmax = w-@r
@ymax = h-@r
@vx = range(0,2)+8*xpos-5
@vy = 0.7*@r+range(-1,1)
draw: ->
@x += @vx
@y += @vy
@opacity += @dop
if @opacity > 1
@opacity = 1
@dop *= -1
@replace() if @opacity < 0 or @y > @ymax
if !(0 < @x < @xmax)
@x = (@x + @xmax) % @xmax
drawCircle(~~@x,~~@y,@r,"#{@rgb},#{@opacity})")
confetti = (new Confetti for i in [1..NUM_CONFETTI])
window.step = ->
requestAnimationFrame(step)
context.clearRect(0,0,w,h)
c.draw() for c in confetti
step()